Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including com.izaakschroeder.dom with all npm packages installed. Try it out:

var comIzaakschroederDom = require("com.izaakschroeder.dom")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

com.izaakschroeder.dom v0.0.7

A simple implementation of the DOM.


A simple and lightweight implementation of the DOM for node.js. Working on implementing DOM levels 1, 2, 3 and 4; capable of using both XML and HTML5 semantics.

XML semantics provided by "sax".

HTML5 semantics provided by "com.izaakschroeder.html5".

    //Load the library
    DOM = require('com.izaakschroeder.dom'),
    //Load filesystem support
    fs = require('fs'),
    //Read a file
    stream = fs.createReadStream('./some-file.html');

//Parse the file
DOM.parse(stream, function(err, document) {
    //Unrecoverable error
    if (err && !document)
        throw new Error();

    //Errors, but we still have a document
    if (err)
        console.log("Warning: errors encountered.");

    //Do some basic work
    document.querySelectorAll("div").forEach(function(node) {
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free