Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
simple dom for xml/html
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
test remove void stuff from test
.gitignore
.travis.yml
README.md
index.js fix void element detection
package.json

README.md

htmltree Build Status

Very simple xml/html -> syntax tree converter. Useful for further mangling your html source.

var htmltree = require('htmltree');

htmltree('<html><body onclick=foo></body></html>', function(err, doc) {
    // doc
    {
        // stuff in the doctype tag
        doctype: undefined || string
        root: [
            ... node type, see below ...
        ]
    }
});

Each node entry is an object with the following form.

// node
[
    {
        type: 'tag' | 'text' | 'comment',
        name: 'html', // set for 'tag' nodes
        attributes: {
        },
        children: [
            {
                tag: body,
                attributes: {
                    onclick: 'foo'
                }
            },
            ...
        ],
        // true if the tag node is a void element no body
        void: boolean
    }
]

license

MIT

Something went wrong with that request. Please try again.