# htmlparser **Repository Path**: gitee_zhangp/htmlparser ## Basic Information - **Project Name**: htmlparser - **Description**: html 抽象语法库 - **Primary Language**: JavaScript - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-01-31 - **Last Updated**: 2021-05-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### [html-parser](https://gitee.com/gitee_zhangp/js-utils/tree/master/utils/html-paser) #### 功能 * 实现html词法分析,将html结构文件转换为对应层级的json数据,可以修改数据并生成新的html文件。 ```javascript // 参考
hello
// 转化为 { name: 'div', tag: 'element', attrs: { class: 'text-white', style: 'color: white' }, children: [{ name: 'hello', tag: 'text', children: [] }] } ``` * 其中$on方法可以监听标签打开和关闭事件,并接受回调函数处理自定义逻辑。 * 兼容处理未合法闭合的标签。