oop-node
OOP模式的结构化节点
安装
npm i oop-node
继承结构
BaseNode
- NamedNode
- Attribute
- ElementAbstract
- ElementBase
+ AttributeList :: attributes
- ElementComment
- ElementText
- Element
+ NodeList<ElementAbstract> :: childNodes
- Document
+ NodeList<ElementAbstract> :: childNodes
- TreeNode
BaseList
- TypedList<T>
- NodeList<T>
- AttributeList<Attribute>
使用
代码
const Document = ; let document = ;let div = doc;div;div;div;div;div;div;console;
输出
<!-- User Name -->Marvin<!-- User Name End -->
带缩进
let document = format: true // 带格式 indent: ' ' // 缩进字符串(默认2空格);
输出
<!-- User Name --> Marvin <!-- User Name End -->