1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/parse5/lib/index.js

30 lines
697 B
JavaScript
Raw Normal View History

2023-12-18 13:12:25 +08:00
'use strict';
2024-01-16 21:26:16 +08:00
const Parser = require('./parser');
const Serializer = require('./serializer');
2023-12-18 13:12:25 +08:00
// Shorthands
exports.parse = function parse(html, options) {
2024-01-16 21:26:16 +08:00
const parser = new Parser(options);
2023-12-18 13:12:25 +08:00
return parser.parse(html);
};
exports.parseFragment = function parseFragment(fragmentContext, html, options) {
if (typeof fragmentContext === 'string') {
options = html;
html = fragmentContext;
fragmentContext = null;
}
2024-01-16 21:26:16 +08:00
const parser = new Parser(options);
2023-12-18 13:12:25 +08:00
return parser.parseFragment(html, fragmentContext);
};
2024-01-16 21:26:16 +08:00
exports.serialize = function(node, options) {
const serializer = new Serializer(node, options);
2023-12-18 13:12:25 +08:00
return serializer.serialize();
};