diff options
| author | Adam Mathes <adam@adammathes.com> | 2026-02-13 21:34:48 -0800 |
|---|---|---|
| committer | Adam Mathes <adam@adammathes.com> | 2026-02-13 21:34:48 -0800 |
| commit | 76cb9c2a39d477a64824a985ade40507e3bbade1 (patch) | |
| tree | 41e997aa9c6f538d3a136af61dae9424db2005a9 /vanilla/node_modules/parse5/dist/index.js | |
| parent | 819a39a21ac992b1393244a4c283bbb125208c69 (diff) | |
| download | neko-76cb9c2a39d477a64824a985ade40507e3bbade1.tar.gz neko-76cb9c2a39d477a64824a985ade40507e3bbade1.tar.bz2 neko-76cb9c2a39d477a64824a985ade40507e3bbade1.zip | |
feat(vanilla): add testing infrastructure and tests (NK-wjnczv)
Diffstat (limited to 'vanilla/node_modules/parse5/dist/index.js')
| -rw-r--r-- | vanilla/node_modules/parse5/dist/index.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/vanilla/node_modules/parse5/dist/index.js b/vanilla/node_modules/parse5/dist/index.js new file mode 100644 index 0000000..ff5b55b --- /dev/null +++ b/vanilla/node_modules/parse5/dist/index.js @@ -0,0 +1,42 @@ +import { Parser } from './parser/index.js'; +export { defaultTreeAdapter } from './tree-adapters/default.js'; +export { /** @internal */ Parser } from './parser/index.js'; +export { serialize, serializeOuter } from './serializer/index.js'; +export { ERR as ErrorCodes } from './common/error-codes.js'; +/** @internal */ +export * as foreignContent from './common/foreign-content.js'; +export * as html from './common/html.js'; +export * as Token from './common/token.js'; +/** @internal */ +export { Tokenizer, TokenizerMode } from './tokenizer/index.js'; +// Shorthands +/** + * Parses an HTML string. + * + * @param html Input HTML string. + * @param options Parsing options. + * @returns Document + * + * @example + * + * ```js + * const parse5 = require('parse5'); + * + * const document = parse5.parse('<!DOCTYPE html><html><head></head><body>Hi there!</body></html>'); + * + * console.log(document.childNodes[1].tagName); //> 'html' + *``` + */ +export function parse(html, options) { + return Parser.parse(html, options); +} +export function parseFragment(fragmentContext, html, options) { + if (typeof fragmentContext === 'string') { + options = html; + html = fragmentContext; + fragmentContext = null; + } + const parser = Parser.getFragmentParser(fragmentContext, options); + parser.tokenizer.write(html, true); + return parser.getFragment(); +} |
