hexo/node_modules/parse5/dist/common/html.js

523 lines
17 KiB
JavaScript

/** All valid namespaces in HTML. */
export var NS;
(function (NS) {
NS["HTML"] = "http://www.w3.org/1999/xhtml";
NS["MATHML"] = "http://www.w3.org/1998/Math/MathML";
NS["SVG"] = "http://www.w3.org/2000/svg";
NS["XLINK"] = "http://www.w3.org/1999/xlink";
NS["XML"] = "http://www.w3.org/XML/1998/namespace";
NS["XMLNS"] = "http://www.w3.org/2000/xmlns/";
})(NS = NS || (NS = {}));
export var ATTRS;
(function (ATTRS) {
ATTRS["TYPE"] = "type";
ATTRS["ACTION"] = "action";
ATTRS["ENCODING"] = "encoding";
ATTRS["PROMPT"] = "prompt";
ATTRS["NAME"] = "name";
ATTRS["COLOR"] = "color";
ATTRS["FACE"] = "face";
ATTRS["SIZE"] = "size";
})(ATTRS = ATTRS || (ATTRS = {}));
/**
* The mode of the document.
*
* @see {@link https://dom.spec.whatwg.org/#concept-document-limited-quirks}
*/
export var DOCUMENT_MODE;
(function (DOCUMENT_MODE) {
DOCUMENT_MODE["NO_QUIRKS"] = "no-quirks";
DOCUMENT_MODE["QUIRKS"] = "quirks";
DOCUMENT_MODE["LIMITED_QUIRKS"] = "limited-quirks";
})(DOCUMENT_MODE = DOCUMENT_MODE || (DOCUMENT_MODE = {}));
export var TAG_NAMES;
(function (TAG_NAMES) {
TAG_NAMES["A"] = "a";
TAG_NAMES["ADDRESS"] = "address";
TAG_NAMES["ANNOTATION_XML"] = "annotation-xml";
TAG_NAMES["APPLET"] = "applet";
TAG_NAMES["AREA"] = "area";
TAG_NAMES["ARTICLE"] = "article";
TAG_NAMES["ASIDE"] = "aside";
TAG_NAMES["B"] = "b";
TAG_NAMES["BASE"] = "base";
TAG_NAMES["BASEFONT"] = "basefont";
TAG_NAMES["BGSOUND"] = "bgsound";
TAG_NAMES["BIG"] = "big";
TAG_NAMES["BLOCKQUOTE"] = "blockquote";
TAG_NAMES["BODY"] = "body";
TAG_NAMES["BR"] = "br";
TAG_NAMES["BUTTON"] = "button";
TAG_NAMES["CAPTION"] = "caption";
TAG_NAMES["CENTER"] = "center";
TAG_NAMES["CODE"] = "code";
TAG_NAMES["COL"] = "col";
TAG_NAMES["COLGROUP"] = "colgroup";
TAG_NAMES["DD"] = "dd";
TAG_NAMES["DESC"] = "desc";
TAG_NAMES["DETAILS"] = "details";
TAG_NAMES["DIALOG"] = "dialog";
TAG_NAMES["DIR"] = "dir";
TAG_NAMES["DIV"] = "div";
TAG_NAMES["DL"] = "dl";
TAG_NAMES["DT"] = "dt";
TAG_NAMES["EM"] = "em";
TAG_NAMES["EMBED"] = "embed";
TAG_NAMES["FIELDSET"] = "fieldset";
TAG_NAMES["FIGCAPTION"] = "figcaption";
TAG_NAMES["FIGURE"] = "figure";
TAG_NAMES["FONT"] = "font";
TAG_NAMES["FOOTER"] = "footer";
TAG_NAMES["FOREIGN_OBJECT"] = "foreignObject";
TAG_NAMES["FORM"] = "form";
TAG_NAMES["FRAME"] = "frame";
TAG_NAMES["FRAMESET"] = "frameset";
TAG_NAMES["H1"] = "h1";
TAG_NAMES["H2"] = "h2";
TAG_NAMES["H3"] = "h3";
TAG_NAMES["H4"] = "h4";
TAG_NAMES["H5"] = "h5";
TAG_NAMES["H6"] = "h6";
TAG_NAMES["HEAD"] = "head";
TAG_NAMES["HEADER"] = "header";
TAG_NAMES["HGROUP"] = "hgroup";
TAG_NAMES["HR"] = "hr";
TAG_NAMES["HTML"] = "html";
TAG_NAMES["I"] = "i";
TAG_NAMES["IMG"] = "img";
TAG_NAMES["IMAGE"] = "image";
TAG_NAMES["INPUT"] = "input";
TAG_NAMES["IFRAME"] = "iframe";
TAG_NAMES["KEYGEN"] = "keygen";
TAG_NAMES["LABEL"] = "label";
TAG_NAMES["LI"] = "li";
TAG_NAMES["LINK"] = "link";
TAG_NAMES["LISTING"] = "listing";
TAG_NAMES["MAIN"] = "main";
TAG_NAMES["MALIGNMARK"] = "malignmark";
TAG_NAMES["MARQUEE"] = "marquee";
TAG_NAMES["MATH"] = "math";
TAG_NAMES["MENU"] = "menu";
TAG_NAMES["META"] = "meta";
TAG_NAMES["MGLYPH"] = "mglyph";
TAG_NAMES["MI"] = "mi";
TAG_NAMES["MO"] = "mo";
TAG_NAMES["MN"] = "mn";
TAG_NAMES["MS"] = "ms";
TAG_NAMES["MTEXT"] = "mtext";
TAG_NAMES["NAV"] = "nav";
TAG_NAMES["NOBR"] = "nobr";
TAG_NAMES["NOFRAMES"] = "noframes";
TAG_NAMES["NOEMBED"] = "noembed";
TAG_NAMES["NOSCRIPT"] = "noscript";
TAG_NAMES["OBJECT"] = "object";
TAG_NAMES["OL"] = "ol";
TAG_NAMES["OPTGROUP"] = "optgroup";
TAG_NAMES["OPTION"] = "option";
TAG_NAMES["P"] = "p";
TAG_NAMES["PARAM"] = "param";
TAG_NAMES["PLAINTEXT"] = "plaintext";
TAG_NAMES["PRE"] = "pre";
TAG_NAMES["RB"] = "rb";
TAG_NAMES["RP"] = "rp";
TAG_NAMES["RT"] = "rt";
TAG_NAMES["RTC"] = "rtc";
TAG_NAMES["RUBY"] = "ruby";
TAG_NAMES["S"] = "s";
TAG_NAMES["SCRIPT"] = "script";
TAG_NAMES["SECTION"] = "section";
TAG_NAMES["SELECT"] = "select";
TAG_NAMES["SOURCE"] = "source";
TAG_NAMES["SMALL"] = "small";
TAG_NAMES["SPAN"] = "span";
TAG_NAMES["STRIKE"] = "strike";
TAG_NAMES["STRONG"] = "strong";
TAG_NAMES["STYLE"] = "style";
TAG_NAMES["SUB"] = "sub";
TAG_NAMES["SUMMARY"] = "summary";
TAG_NAMES["SUP"] = "sup";
TAG_NAMES["TABLE"] = "table";
TAG_NAMES["TBODY"] = "tbody";
TAG_NAMES["TEMPLATE"] = "template";
TAG_NAMES["TEXTAREA"] = "textarea";
TAG_NAMES["TFOOT"] = "tfoot";
TAG_NAMES["TD"] = "td";
TAG_NAMES["TH"] = "th";
TAG_NAMES["THEAD"] = "thead";
TAG_NAMES["TITLE"] = "title";
TAG_NAMES["TR"] = "tr";
TAG_NAMES["TRACK"] = "track";
TAG_NAMES["TT"] = "tt";
TAG_NAMES["U"] = "u";
TAG_NAMES["UL"] = "ul";
TAG_NAMES["SVG"] = "svg";
TAG_NAMES["VAR"] = "var";
TAG_NAMES["WBR"] = "wbr";
TAG_NAMES["XMP"] = "xmp";
})(TAG_NAMES = TAG_NAMES || (TAG_NAMES = {}));
/**
* Tag IDs are numeric IDs for known tag names.
*
* We use tag IDs to improve the performance of tag name comparisons.
*/
export var TAG_ID;
(function (TAG_ID) {
TAG_ID[TAG_ID["UNKNOWN"] = 0] = "UNKNOWN";
TAG_ID[TAG_ID["A"] = 1] = "A";
TAG_ID[TAG_ID["ADDRESS"] = 2] = "ADDRESS";
TAG_ID[TAG_ID["ANNOTATION_XML"] = 3] = "ANNOTATION_XML";
TAG_ID[TAG_ID["APPLET"] = 4] = "APPLET";
TAG_ID[TAG_ID["AREA"] = 5] = "AREA";
TAG_ID[TAG_ID["ARTICLE"] = 6] = "ARTICLE";
TAG_ID[TAG_ID["ASIDE"] = 7] = "ASIDE";
TAG_ID[TAG_ID["B"] = 8] = "B";
TAG_ID[TAG_ID["BASE"] = 9] = "BASE";
TAG_ID[TAG_ID["BASEFONT"] = 10] = "BASEFONT";
TAG_ID[TAG_ID["BGSOUND"] = 11] = "BGSOUND";
TAG_ID[TAG_ID["BIG"] = 12] = "BIG";
TAG_ID[TAG_ID["BLOCKQUOTE"] = 13] = "BLOCKQUOTE";
TAG_ID[TAG_ID["BODY"] = 14] = "BODY";
TAG_ID[TAG_ID["BR"] = 15] = "BR";
TAG_ID[TAG_ID["BUTTON"] = 16] = "BUTTON";
TAG_ID[TAG_ID["CAPTION"] = 17] = "CAPTION";
TAG_ID[TAG_ID["CENTER"] = 18] = "CENTER";
TAG_ID[TAG_ID["CODE"] = 19] = "CODE";
TAG_ID[TAG_ID["COL"] = 20] = "COL";
TAG_ID[TAG_ID["COLGROUP"] = 21] = "COLGROUP";
TAG_ID[TAG_ID["DD"] = 22] = "DD";
TAG_ID[TAG_ID["DESC"] = 23] = "DESC";
TAG_ID[TAG_ID["DETAILS"] = 24] = "DETAILS";
TAG_ID[TAG_ID["DIALOG"] = 25] = "DIALOG";
TAG_ID[TAG_ID["DIR"] = 26] = "DIR";
TAG_ID[TAG_ID["DIV"] = 27] = "DIV";
TAG_ID[TAG_ID["DL"] = 28] = "DL";
TAG_ID[TAG_ID["DT"] = 29] = "DT";
TAG_ID[TAG_ID["EM"] = 30] = "EM";
TAG_ID[TAG_ID["EMBED"] = 31] = "EMBED";
TAG_ID[TAG_ID["FIELDSET"] = 32] = "FIELDSET";
TAG_ID[TAG_ID["FIGCAPTION"] = 33] = "FIGCAPTION";
TAG_ID[TAG_ID["FIGURE"] = 34] = "FIGURE";
TAG_ID[TAG_ID["FONT"] = 35] = "FONT";
TAG_ID[TAG_ID["FOOTER"] = 36] = "FOOTER";
TAG_ID[TAG_ID["FOREIGN_OBJECT"] = 37] = "FOREIGN_OBJECT";
TAG_ID[TAG_ID["FORM"] = 38] = "FORM";
TAG_ID[TAG_ID["FRAME"] = 39] = "FRAME";
TAG_ID[TAG_ID["FRAMESET"] = 40] = "FRAMESET";
TAG_ID[TAG_ID["H1"] = 41] = "H1";
TAG_ID[TAG_ID["H2"] = 42] = "H2";
TAG_ID[TAG_ID["H3"] = 43] = "H3";
TAG_ID[TAG_ID["H4"] = 44] = "H4";
TAG_ID[TAG_ID["H5"] = 45] = "H5";
TAG_ID[TAG_ID["H6"] = 46] = "H6";
TAG_ID[TAG_ID["HEAD"] = 47] = "HEAD";
TAG_ID[TAG_ID["HEADER"] = 48] = "HEADER";
TAG_ID[TAG_ID["HGROUP"] = 49] = "HGROUP";
TAG_ID[TAG_ID["HR"] = 50] = "HR";
TAG_ID[TAG_ID["HTML"] = 51] = "HTML";
TAG_ID[TAG_ID["I"] = 52] = "I";
TAG_ID[TAG_ID["IMG"] = 53] = "IMG";
TAG_ID[TAG_ID["IMAGE"] = 54] = "IMAGE";
TAG_ID[TAG_ID["INPUT"] = 55] = "INPUT";
TAG_ID[TAG_ID["IFRAME"] = 56] = "IFRAME";
TAG_ID[TAG_ID["KEYGEN"] = 57] = "KEYGEN";
TAG_ID[TAG_ID["LABEL"] = 58] = "LABEL";
TAG_ID[TAG_ID["LI"] = 59] = "LI";
TAG_ID[TAG_ID["LINK"] = 60] = "LINK";
TAG_ID[TAG_ID["LISTING"] = 61] = "LISTING";
TAG_ID[TAG_ID["MAIN"] = 62] = "MAIN";
TAG_ID[TAG_ID["MALIGNMARK"] = 63] = "MALIGNMARK";
TAG_ID[TAG_ID["MARQUEE"] = 64] = "MARQUEE";
TAG_ID[TAG_ID["MATH"] = 65] = "MATH";
TAG_ID[TAG_ID["MENU"] = 66] = "MENU";
TAG_ID[TAG_ID["META"] = 67] = "META";
TAG_ID[TAG_ID["MGLYPH"] = 68] = "MGLYPH";
TAG_ID[TAG_ID["MI"] = 69] = "MI";
TAG_ID[TAG_ID["MO"] = 70] = "MO";
TAG_ID[TAG_ID["MN"] = 71] = "MN";
TAG_ID[TAG_ID["MS"] = 72] = "MS";
TAG_ID[TAG_ID["MTEXT"] = 73] = "MTEXT";
TAG_ID[TAG_ID["NAV"] = 74] = "NAV";
TAG_ID[TAG_ID["NOBR"] = 75] = "NOBR";
TAG_ID[TAG_ID["NOFRAMES"] = 76] = "NOFRAMES";
TAG_ID[TAG_ID["NOEMBED"] = 77] = "NOEMBED";
TAG_ID[TAG_ID["NOSCRIPT"] = 78] = "NOSCRIPT";
TAG_ID[TAG_ID["OBJECT"] = 79] = "OBJECT";
TAG_ID[TAG_ID["OL"] = 80] = "OL";
TAG_ID[TAG_ID["OPTGROUP"] = 81] = "OPTGROUP";
TAG_ID[TAG_ID["OPTION"] = 82] = "OPTION";
TAG_ID[TAG_ID["P"] = 83] = "P";
TAG_ID[TAG_ID["PARAM"] = 84] = "PARAM";
TAG_ID[TAG_ID["PLAINTEXT"] = 85] = "PLAINTEXT";
TAG_ID[TAG_ID["PRE"] = 86] = "PRE";
TAG_ID[TAG_ID["RB"] = 87] = "RB";
TAG_ID[TAG_ID["RP"] = 88] = "RP";
TAG_ID[TAG_ID["RT"] = 89] = "RT";
TAG_ID[TAG_ID["RTC"] = 90] = "RTC";
TAG_ID[TAG_ID["RUBY"] = 91] = "RUBY";
TAG_ID[TAG_ID["S"] = 92] = "S";
TAG_ID[TAG_ID["SCRIPT"] = 93] = "SCRIPT";
TAG_ID[TAG_ID["SECTION"] = 94] = "SECTION";
TAG_ID[TAG_ID["SELECT"] = 95] = "SELECT";
TAG_ID[TAG_ID["SOURCE"] = 96] = "SOURCE";
TAG_ID[TAG_ID["SMALL"] = 97] = "SMALL";
TAG_ID[TAG_ID["SPAN"] = 98] = "SPAN";
TAG_ID[TAG_ID["STRIKE"] = 99] = "STRIKE";
TAG_ID[TAG_ID["STRONG"] = 100] = "STRONG";
TAG_ID[TAG_ID["STYLE"] = 101] = "STYLE";
TAG_ID[TAG_ID["SUB"] = 102] = "SUB";
TAG_ID[TAG_ID["SUMMARY"] = 103] = "SUMMARY";
TAG_ID[TAG_ID["SUP"] = 104] = "SUP";
TAG_ID[TAG_ID["TABLE"] = 105] = "TABLE";
TAG_ID[TAG_ID["TBODY"] = 106] = "TBODY";
TAG_ID[TAG_ID["TEMPLATE"] = 107] = "TEMPLATE";
TAG_ID[TAG_ID["TEXTAREA"] = 108] = "TEXTAREA";
TAG_ID[TAG_ID["TFOOT"] = 109] = "TFOOT";
TAG_ID[TAG_ID["TD"] = 110] = "TD";
TAG_ID[TAG_ID["TH"] = 111] = "TH";
TAG_ID[TAG_ID["THEAD"] = 112] = "THEAD";
TAG_ID[TAG_ID["TITLE"] = 113] = "TITLE";
TAG_ID[TAG_ID["TR"] = 114] = "TR";
TAG_ID[TAG_ID["TRACK"] = 115] = "TRACK";
TAG_ID[TAG_ID["TT"] = 116] = "TT";
TAG_ID[TAG_ID["U"] = 117] = "U";
TAG_ID[TAG_ID["UL"] = 118] = "UL";
TAG_ID[TAG_ID["SVG"] = 119] = "SVG";
TAG_ID[TAG_ID["VAR"] = 120] = "VAR";
TAG_ID[TAG_ID["WBR"] = 121] = "WBR";
TAG_ID[TAG_ID["XMP"] = 122] = "XMP";
})(TAG_ID = TAG_ID || (TAG_ID = {}));
const TAG_NAME_TO_ID = new Map([
[TAG_NAMES.A, TAG_ID.A],
[TAG_NAMES.ADDRESS, TAG_ID.ADDRESS],
[TAG_NAMES.ANNOTATION_XML, TAG_ID.ANNOTATION_XML],
[TAG_NAMES.APPLET, TAG_ID.APPLET],
[TAG_NAMES.AREA, TAG_ID.AREA],
[TAG_NAMES.ARTICLE, TAG_ID.ARTICLE],
[TAG_NAMES.ASIDE, TAG_ID.ASIDE],
[TAG_NAMES.B, TAG_ID.B],
[TAG_NAMES.BASE, TAG_ID.BASE],
[TAG_NAMES.BASEFONT, TAG_ID.BASEFONT],
[TAG_NAMES.BGSOUND, TAG_ID.BGSOUND],
[TAG_NAMES.BIG, TAG_ID.BIG],
[TAG_NAMES.BLOCKQUOTE, TAG_ID.BLOCKQUOTE],
[TAG_NAMES.BODY, TAG_ID.BODY],
[TAG_NAMES.BR, TAG_ID.BR],
[TAG_NAMES.BUTTON, TAG_ID.BUTTON],
[TAG_NAMES.CAPTION, TAG_ID.CAPTION],
[TAG_NAMES.CENTER, TAG_ID.CENTER],
[TAG_NAMES.CODE, TAG_ID.CODE],
[TAG_NAMES.COL, TAG_ID.COL],
[TAG_NAMES.COLGROUP, TAG_ID.COLGROUP],
[TAG_NAMES.DD, TAG_ID.DD],
[TAG_NAMES.DESC, TAG_ID.DESC],
[TAG_NAMES.DETAILS, TAG_ID.DETAILS],
[TAG_NAMES.DIALOG, TAG_ID.DIALOG],
[TAG_NAMES.DIR, TAG_ID.DIR],
[TAG_NAMES.DIV, TAG_ID.DIV],
[TAG_NAMES.DL, TAG_ID.DL],
[TAG_NAMES.DT, TAG_ID.DT],
[TAG_NAMES.EM, TAG_ID.EM],
[TAG_NAMES.EMBED, TAG_ID.EMBED],
[TAG_NAMES.FIELDSET, TAG_ID.FIELDSET],
[TAG_NAMES.FIGCAPTION, TAG_ID.FIGCAPTION],
[TAG_NAMES.FIGURE, TAG_ID.FIGURE],
[TAG_NAMES.FONT, TAG_ID.FONT],
[TAG_NAMES.FOOTER, TAG_ID.FOOTER],
[TAG_NAMES.FOREIGN_OBJECT, TAG_ID.FOREIGN_OBJECT],
[TAG_NAMES.FORM, TAG_ID.FORM],
[TAG_NAMES.FRAME, TAG_ID.FRAME],
[TAG_NAMES.FRAMESET, TAG_ID.FRAMESET],
[TAG_NAMES.H1, TAG_ID.H1],
[TAG_NAMES.H2, TAG_ID.H2],
[TAG_NAMES.H3, TAG_ID.H3],
[TAG_NAMES.H4, TAG_ID.H4],
[TAG_NAMES.H5, TAG_ID.H5],
[TAG_NAMES.H6, TAG_ID.H6],
[TAG_NAMES.HEAD, TAG_ID.HEAD],
[TAG_NAMES.HEADER, TAG_ID.HEADER],
[TAG_NAMES.HGROUP, TAG_ID.HGROUP],
[TAG_NAMES.HR, TAG_ID.HR],
[TAG_NAMES.HTML, TAG_ID.HTML],
[TAG_NAMES.I, TAG_ID.I],
[TAG_NAMES.IMG, TAG_ID.IMG],
[TAG_NAMES.IMAGE, TAG_ID.IMAGE],
[TAG_NAMES.INPUT, TAG_ID.INPUT],
[TAG_NAMES.IFRAME, TAG_ID.IFRAME],
[TAG_NAMES.KEYGEN, TAG_ID.KEYGEN],
[TAG_NAMES.LABEL, TAG_ID.LABEL],
[TAG_NAMES.LI, TAG_ID.LI],
[TAG_NAMES.LINK, TAG_ID.LINK],
[TAG_NAMES.LISTING, TAG_ID.LISTING],
[TAG_NAMES.MAIN, TAG_ID.MAIN],
[TAG_NAMES.MALIGNMARK, TAG_ID.MALIGNMARK],
[TAG_NAMES.MARQUEE, TAG_ID.MARQUEE],
[TAG_NAMES.MATH, TAG_ID.MATH],
[TAG_NAMES.MENU, TAG_ID.MENU],
[TAG_NAMES.META, TAG_ID.META],
[TAG_NAMES.MGLYPH, TAG_ID.MGLYPH],
[TAG_NAMES.MI, TAG_ID.MI],
[TAG_NAMES.MO, TAG_ID.MO],
[TAG_NAMES.MN, TAG_ID.MN],
[TAG_NAMES.MS, TAG_ID.MS],
[TAG_NAMES.MTEXT, TAG_ID.MTEXT],
[TAG_NAMES.NAV, TAG_ID.NAV],
[TAG_NAMES.NOBR, TAG_ID.NOBR],
[TAG_NAMES.NOFRAMES, TAG_ID.NOFRAMES],
[TAG_NAMES.NOEMBED, TAG_ID.NOEMBED],
[TAG_NAMES.NOSCRIPT, TAG_ID.NOSCRIPT],
[TAG_NAMES.OBJECT, TAG_ID.OBJECT],
[TAG_NAMES.OL, TAG_ID.OL],
[TAG_NAMES.OPTGROUP, TAG_ID.OPTGROUP],
[TAG_NAMES.OPTION, TAG_ID.OPTION],
[TAG_NAMES.P, TAG_ID.P],
[TAG_NAMES.PARAM, TAG_ID.PARAM],
[TAG_NAMES.PLAINTEXT, TAG_ID.PLAINTEXT],
[TAG_NAMES.PRE, TAG_ID.PRE],
[TAG_NAMES.RB, TAG_ID.RB],
[TAG_NAMES.RP, TAG_ID.RP],
[TAG_NAMES.RT, TAG_ID.RT],
[TAG_NAMES.RTC, TAG_ID.RTC],
[TAG_NAMES.RUBY, TAG_ID.RUBY],
[TAG_NAMES.S, TAG_ID.S],
[TAG_NAMES.SCRIPT, TAG_ID.SCRIPT],
[TAG_NAMES.SECTION, TAG_ID.SECTION],
[TAG_NAMES.SELECT, TAG_ID.SELECT],
[TAG_NAMES.SOURCE, TAG_ID.SOURCE],
[TAG_NAMES.SMALL, TAG_ID.SMALL],
[TAG_NAMES.SPAN, TAG_ID.SPAN],
[TAG_NAMES.STRIKE, TAG_ID.STRIKE],
[TAG_NAMES.STRONG, TAG_ID.STRONG],
[TAG_NAMES.STYLE, TAG_ID.STYLE],
[TAG_NAMES.SUB, TAG_ID.SUB],
[TAG_NAMES.SUMMARY, TAG_ID.SUMMARY],
[TAG_NAMES.SUP, TAG_ID.SUP],
[TAG_NAMES.TABLE, TAG_ID.TABLE],
[TAG_NAMES.TBODY, TAG_ID.TBODY],
[TAG_NAMES.TEMPLATE, TAG_ID.TEMPLATE],
[TAG_NAMES.TEXTAREA, TAG_ID.TEXTAREA],
[TAG_NAMES.TFOOT, TAG_ID.TFOOT],
[TAG_NAMES.TD, TAG_ID.TD],
[TAG_NAMES.TH, TAG_ID.TH],
[TAG_NAMES.THEAD, TAG_ID.THEAD],
[TAG_NAMES.TITLE, TAG_ID.TITLE],
[TAG_NAMES.TR, TAG_ID.TR],
[TAG_NAMES.TRACK, TAG_ID.TRACK],
[TAG_NAMES.TT, TAG_ID.TT],
[TAG_NAMES.U, TAG_ID.U],
[TAG_NAMES.UL, TAG_ID.UL],
[TAG_NAMES.SVG, TAG_ID.SVG],
[TAG_NAMES.VAR, TAG_ID.VAR],
[TAG_NAMES.WBR, TAG_ID.WBR],
[TAG_NAMES.XMP, TAG_ID.XMP],
]);
export function getTagID(tagName) {
var _a;
return (_a = TAG_NAME_TO_ID.get(tagName)) !== null && _a !== void 0 ? _a : TAG_ID.UNKNOWN;
}
const $ = TAG_ID;
export const SPECIAL_ELEMENTS = {
[NS.HTML]: new Set([
$.ADDRESS,
$.APPLET,
$.AREA,
$.ARTICLE,
$.ASIDE,
$.BASE,
$.BASEFONT,
$.BGSOUND,
$.BLOCKQUOTE,
$.BODY,
$.BR,
$.BUTTON,
$.CAPTION,
$.CENTER,
$.COL,
$.COLGROUP,
$.DD,
$.DETAILS,
$.DIR,
$.DIV,
$.DL,
$.DT,
$.EMBED,
$.FIELDSET,
$.FIGCAPTION,
$.FIGURE,
$.FOOTER,
$.FORM,
$.FRAME,
$.FRAMESET,
$.H1,
$.H2,
$.H3,
$.H4,
$.H5,
$.H6,
$.HEAD,
$.HEADER,
$.HGROUP,
$.HR,
$.HTML,
$.IFRAME,
$.IMG,
$.INPUT,
$.LI,
$.LINK,
$.LISTING,
$.MAIN,
$.MARQUEE,
$.MENU,
$.META,
$.NAV,
$.NOEMBED,
$.NOFRAMES,
$.NOSCRIPT,
$.OBJECT,
$.OL,
$.P,
$.PARAM,
$.PLAINTEXT,
$.PRE,
$.SCRIPT,
$.SECTION,
$.SELECT,
$.SOURCE,
$.STYLE,
$.SUMMARY,
$.TABLE,
$.TBODY,
$.TD,
$.TEMPLATE,
$.TEXTAREA,
$.TFOOT,
$.TH,
$.THEAD,
$.TITLE,
$.TR,
$.TRACK,
$.UL,
$.WBR,
$.XMP,
]),
[NS.MATHML]: new Set([$.MI, $.MO, $.MN, $.MS, $.MTEXT, $.ANNOTATION_XML]),
[NS.SVG]: new Set([$.TITLE, $.FOREIGN_OBJECT, $.DESC]),
[NS.XLINK]: new Set(),
[NS.XML]: new Set(),
[NS.XMLNS]: new Set(),
};
export function isNumberedHeader(tn) {
return tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6;
}
const UNESCAPED_TEXT = new Set([
TAG_NAMES.STYLE,
TAG_NAMES.SCRIPT,
TAG_NAMES.XMP,
TAG_NAMES.IFRAME,
TAG_NAMES.NOEMBED,
TAG_NAMES.NOFRAMES,
TAG_NAMES.PLAINTEXT,
]);
export function hasUnescapedText(tn, scriptingEnabled) {
return UNESCAPED_TEXT.has(tn) || (scriptingEnabled && tn === TAG_NAMES.NOSCRIPT);
}
//# sourceMappingURL=html.js.map