import { TAG_NAMES as $, NS, hasUnescapedText } from '../common/html.js'; import { escapeText, escapeAttribute } from 'entities/lib/escape.js'; import { defaultTreeAdapter } from '../tree-adapters/default.js'; // Sets const VOID_ELEMENTS = new Set([ $.AREA, $.BASE, $.BASEFONT, $.BGSOUND, $.BR, $.COL, $.EMBED, $.FRAME, $.HR, $.IMG, $.INPUT, $.KEYGEN, $.LINK, $.META, $.PARAM, $.SOURCE, $.TRACK, $.WBR, ]); function isVoidElement(node, options) { return (options.treeAdapter.isElementNode(node) && options.treeAdapter.getNamespaceURI(node) === NS.HTML && VOID_ELEMENTS.has(options.treeAdapter.getTagName(node))); } const defaultOpts = { treeAdapter: defaultTreeAdapter, scriptingEnabled: true }; /** * Serializes an AST node to an HTML string. * * @example * * ```js * const parse5 = require('parse5'); * * const document = parse5.parse('Hi there!