simple tree data structure for html source
htmltree 
Very simple xml/html -> syntax tree converter. Useful for further mangling your html source.
var htmltree = require('htmltree');
htmltree('
', 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
Repository
这是一个将HTML源码转换为非常简单的XML/HTML语法树的工具,适用于进一步处理HTML源码。它返回一个对象,包含文档类型、根节点和各节点信息,每个节点包含类型、名称、属性、子节点等详细信息。
840

被折叠的 条评论
为什么被折叠?



