htmltree
simple tree data structure for html source
Last updated 7 years ago by shtylman .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install htmltree 
SYNC missed versions from official npm registry.

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

Current Tags

  • 0.0.4                                ...           latest (7 years ago)

4 Versions

  • 0.0.4                                ...           7 years ago
  • 0.0.3                                ...           8 years ago
  • 0.0.2                                ...           8 years ago
  • 0.0.1                                ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 2
Dependencies (1)
Dev Dependencies (1)

Copyright 2014 - 2017 © taobao.org |