/* MIT License http://www.opensource.org/licenses/mit-license.php Author sheo13666q @sheo13666q */ "use strict"; // GENERATED by tooling/generate-html-data.js — do not edit. // cspell:ignore advasoft altglyph altglyphdef altglyphitem animatecolor animatemotion animatetransform arcrole aswedit attributename attributetype basefrequency baseprofile bgsound calcmode clippathunits contenteditable diffuseconstant enterkeyhint fedropshadow filterunits formenctype formmethod formtarget glyphref gradienttransform gradientunits hotjava hotmetal inputmode jscript kernelmatrix kernelunitlength keypoints keysplines keytimes limitingconeangle livescript markerheight markerwidth maskcontentunits maskunits metrius mtext numoctaves pathlength patterncontentunits patterntransform patternunits pointsatx pointsaty pointsatz preservealpha primitiveunits refx refy repeatcount repeatdur requiredextensions requiredfeatures silmaril softquad specularconstant specularexponent startoffset stddeviation stitchtiles surfacescale systemlanguage tablevalues targetx targety textlength viewbox viewtarget webtechs writingsuggestions xchannelselector ychannelselector // Reflected-attribute tables from webref's extraction of the HTML IDL (see tooling/generate-html-data.js); everything else is the // generator's SUPPLEMENT, which carries the spec facts no dataset states. /** * An "adjust … name" table: each name under the lowercase spelling the tokenizer * hands over, which is that name lowercased — so only the names are stated and * no key can drift from the value it maps to. Null-prototype, so a name like * `constructor` is a miss rather than a hit. * @param {string[]} names the adjusted names * @returns {Record} the table */ const adjusted = (names) => { /** @type {Record} */ const table = Object.create(null); for (const name of names) table[name.toLowerCase()] = name; return table; }; /** * §13.1.2.4: the elements a `

` end tag may be omitted in front of. * @type {Set} */ const P_FOLLOWED_BY = new Set([ "address", "article", "aside", "blockquote", "details", "div", "dl", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "header", "hgroup", "hr", "main", "menu", "nav", "ol", "p", "pre", "section", "table", "ul" ]); /** * §13.1.2.4: the element names whose end tag may be omitted when the next * sibling is one of the mapped names. ``, `` and `` are * deliberately absent — their end tags are omissible too, but non-browser * consumers routinely mis-parse a document that is missing them. * @type {Map>} */ const OPTIONAL_END_TAG_FOLLOWERS = new Map([ ["li", new Set(["li"])], ["dt", new Set(["dt", "dd"])], ["dd", new Set(["dd", "dt"])], ["rt", new Set(["rt", "rp"])], ["rp", new Set(["rt", "rp"])], ["optgroup", new Set(["optgroup"])], ["option", new Set(["option", "optgroup"])], ["thead", new Set(["tbody", "tfoot"])], ["tbody", new Set(["tbody", "tfoot"])], ["tfoot", new Set()], ["tr", new Set(["tr"])], ["td", new Set(["td", "th"])], ["th", new Set(["td", "th"])], ["p", P_FOLLOWED_BY] ]); /** * §13.1.2.4: the elements whose end tag may be omitted unless ASCII whitespace * or a comment follows. A different condition from the follower-set rule above: * what closes these is the insertion mode, whatever the next element is, so only * a node that would move inside them keeps the tag. * @type {Set} */ const OPTIONAL_END_TAG_UNLESS_TRAILING_NODE = new Set(["caption", "colgroup"]); /** * The subset of `OPTIONAL_END_TAG_FOLLOWERS` that may also drop the end tag with * nothing left in the parent. `

` and `` are absent: the spec gives * them no such clause. * @type {Set} */ const OPTIONAL_END_TAG_AT_END = new Set([ "li", "dd", "rt", "rp", "optgroup", "option", "tbody", "tfoot", "tr", "td", "th", "p" ]); /** * Every attribute name a value rewrite can act on. One miss here rules an * attribute out of the whole chain, which is what most of them are. * @type {Set} */ const REWRITABLE_ATTRIBUTES = new Set([ "accept", "accesskey", "action", "autocapitalize", "autocomplete", "blocking", "cite", "class", "codebase", "cols", "colspan", "content", "contenteditable", "coords", "crossorigin", "data", "decoding", "dir", "draggable", "enctype", "enterkeyhint", "fetchpriority", "for", "formaction", "formenctype", "formmethod", "headers", "headingoffset", "height", "hidden", "href", "hspace", "imagesrcset", "inputmode", "itemprop", "itemref", "itemtype", "kind", "loading", "longdesc", "lowsrc", "manifest", "maxlength", "method", "minlength", "part", "ping", "popover", "poster", "preload", "referrerpolicy", "rel", "rows", "rowspan", "sandbox", "scope", "size", "sizes", "span", "spellcheck", "src", "srcset", "start", "style", "tabindex", "translate", "type", "value", "vspace", "width", "writingsuggestions" ]); /** * Every name `ENUMERATED_KEYWORDS` scopes, whatever the element. One miss here * rules an attribute out, which is what keeps the enumerated fold off the cost * of every attribute that enumerates nothing. * @type {Set} */ const ENUMERATED_ATTRIBUTE_NAMES = new Set([ "autocapitalize", "autocomplete", "contenteditable", "crossorigin", "decoding", "dir", "draggable", "enctype", "enterkeyhint", "fetchpriority", "formenctype", "formmethod", "hidden", "inputmode", "kind", "loading", "method", "popover", "preload", "referrerpolicy", "scope", "spellcheck", "translate", "type", "writingsuggestions" ]); /** * A void element that belongs in the head: with no attributes it states nothing, * so `removeEmptyElements` may drop it even though every other void element is * kept. Derived as the head elements that are also void. * @type {Set} */ const EMPTY_METADATA_ELEMENTS = new Set(["base", "link", "meta"]); /** * §13.1.2.4: the elements that keep a `` start tag when the body opens * with one — the parser reads them as head content and would move them out of * the body once the tag goes. * @type {Set} */ const BODY_START_KEPT_BEFORE = new Set([ "link", "meta", "noscript", "script", "style", "template" ]); /** * Parents whose own end tag generates implied end tags, so a trailing `

` * inside one is closed by it and can be left out (§13.2.6.4.7). Listed rather * than excluded: an end tag not named here is "any other end tag", which a * special element on the stack makes the parser ignore — so anything unknown, * a custom element included, keeps its `

`. * @type {Set} */ const P_ENDS_ON_PARENT_END_TAG = new Set([ "address", "applet", "article", "aside", "blockquote", "body", "button", "caption", "center", "colgroup", "dd", "details", "dialog", "dir", "div", "dl", "dt", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "html", "li", "listing", "main", "marquee", "menu", "nav", "object", "ol", "pre", "search", "section", "select", "summary", "table", "tbody", "td", "template", "tfoot", "th", "thead", "tr", "ul" ]); /** * §2.4.2 boolean attributes, mapped to the elements each one is boolean *on* * (`null` = a global attribute). Elsewhere the same name is an ordinary * attribute whose value a script may read. * @type {Map | null>} */ const BOOLEAN_ATTRIBUTES = new Map([ ["allowfullscreen", new Set(["iframe"])], ["alpha", new Set(["input"])], ["async", new Set(["script"])], ["autofocus", null], ["autoplay", new Set(["audio", "video"])], ["checked", new Set(["input"])], ["compact", new Set(["dl", "menu", "ol", "ul"])], ["controls", new Set(["audio", "img", "video"])], ["declare", new Set(["object"])], ["default", new Set(["track"])], ["defer", new Set(["script"])], [ "disabled", new Set([ "button", "fieldset", "input", "link", "optgroup", "option", "select", "textarea" ]) ], ["formnovalidate", new Set(["button", "input"])], ["headingreset", null], ["inert", null], ["ismap", new Set(["img"])], ["itemscope", null], ["loop", new Set(["audio", "video"])], ["multiple", new Set(["input", "select"])], ["muted", new Set(["audio", "video"])], ["nohref", new Set(["area"])], ["nomodule", new Set(["script"])], ["noshade", new Set(["hr"])], ["novalidate", new Set(["form"])], ["nowrap", new Set(["td", "th"])], ["open", new Set(["details", "dialog"])], ["playsinline", new Set(["video"])], ["readonly", new Set(["input", "textarea"])], ["required", new Set(["input", "select", "textarea"])], ["reversed", new Set(["ol"])], ["selected", new Set(["option"])], ["shadowrootclonable", new Set(["template"])], ["shadowrootdelegatesfocus", new Set(["template"])], ["shadowrootserializable", new Set(["template"])] ]); /** * The attributes whose value is a srcset (WHATWG "parse a srcset attribute"). * @type {Set} */ const SRCSET_ATTRIBUTES = new Set(["srcset", "imagesrcset"]); /** * The attributes whose value is an ASCII-whitespace-separated token list, mapped * to the elements they are one on (`null` = a global attribute), so collapsing * the separators keeps the set the DOM reads. The element matters: `for` is a * token list on `` but one id on `