import Tokenizer from "./Tokenizer.ts"; import EventEmitter from "https://deno.land/x/events@v1.0.0/mod.ts"; const formTags = new Set([ "input", "option", "optgroup", "select", "button", "datalist", "textarea", ]); const pTag = new Set(["p"]); const openImpliesClose: Record> = { tr: new Set(["tr", "th", "td"]), th: new Set(["th"]), td: new Set(["thead", "th", "td"]), body: new Set(["head", "link", "script"]), li: new Set(["li"]), p: pTag, h1: pTag, h2: pTag, h3: pTag, h4: pTag, h5: pTag, h6: pTag, select: formTags, input: formTags, output: formTags, button: formTags, datalist: formTags, textarea: formTags, option: new Set(["option"]), optgroup: new Set(["optgroup", "option"]), dd: new Set(["dt", "dd"]), dt: new Set(["dt", "dd"]), address: pTag, article: pTag, aside: pTag, blockquote: pTag, details: pTag, div: pTag, dl: pTag, fieldset: pTag, figcaption: pTag, figure: pTag, footer: pTag, form: pTag, header: pTag, hr: pTag, main: pTag, nav: pTag, ol: pTag, pre: pTag, section: pTag, table: pTag, ul: pTag, rt: new Set(["rt", "rp"]), rp: new Set(["rt", "rp"]), tbody: new Set(["thead", "tbody"]), tfoot: new Set(["thead", "tbody"]), }; const voidElements = new Set([ "area", "base", "basefont", "br", "col", "command", "embed", "frame", "hr", "img", "input", "isindex", "keygen", "link", "meta", "param", "source", "track", "wbr", ]); const foreignContextElements = new Set(["math", "svg"]); const htmlIntegrationElements = new Set([ "mi", "mo", "mn", "ms", "mtext", "annotation-xml", "foreignObject", "desc", "title", ]); export interface ParserOptions { /*** * Indicates whether special tags (