@shell-shock/preset-cli 0.9.11 → 0.9.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.cjs +16 -0
- package/dist/_virtual/_rolldown/runtime.mjs +42 -0
- package/dist/components/banner-builtin.cjs +3 -3
- package/dist/components/banner-builtin.mjs +3 -3
- package/dist/components/banner-builtin.mjs.map +1 -1
- package/dist/components/command-entry.cjs +1 -0
- package/dist/components/command-entry.mjs +1 -0
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/upgrade-builtin.cjs +1 -1
- package/dist/components/upgrade-builtin.mjs +1 -1
- package/dist/components/upgrade-builtin.mjs.map +1 -1
- package/dist/components/virtual-command-entry.cjs +1 -0
- package/dist/components/virtual-command-entry.mjs +1 -0
- package/dist/components/virtual-command-entry.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/node_modules/.pnpm/@mdit_plugin-alert@0.23.2_markdown-it@14.1.1/node_modules/@mdit/plugin-alert/dist/index.cjs +94 -0
- package/dist/node_modules/.pnpm/@mdit_plugin-alert@0.23.2_markdown-it@14.1.1/node_modules/@mdit/plugin-alert/dist/index.mjs +94 -0
- package/dist/node_modules/.pnpm/@mdit_plugin-alert@0.23.2_markdown-it@14.1.1/node_modules/@mdit/plugin-alert/dist/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/ansi-styles@6.2.3/node_modules/ansi-styles/index.cjs +167 -0
- package/dist/node_modules/.pnpm/ansi-styles@6.2.3/node_modules/ansi-styles/index.mjs +167 -0
- package/dist/node_modules/.pnpm/ansi-styles@6.2.3/node_modules/ansi-styles/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/entities@4.5.0/node_modules/entities/lib/esm/decode.cjs +373 -0
- package/dist/node_modules/.pnpm/entities@4.5.0/node_modules/entities/lib/esm/decode.mjs +374 -0
- package/dist/node_modules/.pnpm/entities@4.5.0/node_modules/entities/lib/esm/decode.mjs.map +1 -0
- package/dist/node_modules/.pnpm/entities@4.5.0/node_modules/entities/lib/esm/decode_codepoint.cjs +60 -0
- package/dist/node_modules/.pnpm/entities@4.5.0/node_modules/entities/lib/esm/decode_codepoint.mjs +59 -0
- package/dist/node_modules/.pnpm/entities@4.5.0/node_modules/entities/lib/esm/decode_codepoint.mjs.map +1 -0
- package/dist/node_modules/.pnpm/entities@4.5.0/node_modules/entities/lib/esm/generated/decode-data-html.cjs +6 -0
- package/dist/node_modules/.pnpm/entities@4.5.0/node_modules/entities/lib/esm/generated/decode-data-html.mjs +6 -0
- package/dist/node_modules/.pnpm/entities@4.5.0/node_modules/entities/lib/esm/generated/decode-data-html.mjs.map +1 -0
- package/dist/node_modules/.pnpm/entities@4.5.0/node_modules/entities/lib/esm/generated/decode-data-xml.cjs +6 -0
- package/dist/node_modules/.pnpm/entities@4.5.0/node_modules/entities/lib/esm/generated/decode-data-xml.mjs +6 -0
- package/dist/node_modules/.pnpm/entities@4.5.0/node_modules/entities/lib/esm/generated/decode-data-xml.mjs.map +1 -0
- package/dist/node_modules/.pnpm/entities@6.0.1/node_modules/entities/dist/esm/decode-codepoint.cjs +59 -0
- package/dist/node_modules/.pnpm/entities@6.0.1/node_modules/entities/dist/esm/decode-codepoint.mjs +59 -0
- package/dist/node_modules/.pnpm/entities@6.0.1/node_modules/entities/dist/esm/decode-codepoint.mjs.map +1 -0
- package/dist/node_modules/.pnpm/entities@6.0.1/node_modules/entities/dist/esm/decode.cjs +338 -0
- package/dist/node_modules/.pnpm/entities@6.0.1/node_modules/entities/dist/esm/decode.mjs +333 -0
- package/dist/node_modules/.pnpm/entities@6.0.1/node_modules/entities/dist/esm/decode.mjs.map +1 -0
- package/dist/node_modules/.pnpm/entities@6.0.1/node_modules/entities/dist/esm/generated/decode-data-html.cjs +6 -0
- package/dist/node_modules/.pnpm/entities@6.0.1/node_modules/entities/dist/esm/generated/decode-data-html.mjs +6 -0
- package/dist/node_modules/.pnpm/entities@6.0.1/node_modules/entities/dist/esm/generated/decode-data-html.mjs.map +1 -0
- package/dist/node_modules/.pnpm/he@1.2.0/node_modules/he/he.cjs +4095 -0
- package/dist/node_modules/.pnpm/he@1.2.0/node_modules/he/he.mjs +4093 -0
- package/dist/node_modules/.pnpm/he@1.2.0/node_modules/he/he.mjs.map +1 -0
- package/dist/node_modules/.pnpm/linkify-it@5.0.0/node_modules/linkify-it/index.cjs +449 -0
- package/dist/node_modules/.pnpm/linkify-it@5.0.0/node_modules/linkify-it/index.mjs +450 -0
- package/dist/node_modules/.pnpm/linkify-it@5.0.0/node_modules/linkify-it/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/linkify-it@5.0.0/node_modules/linkify-it/lib/re.cjs +47 -0
- package/dist/node_modules/.pnpm/linkify-it@5.0.0/node_modules/linkify-it/lib/re.mjs +48 -0
- package/dist/node_modules/.pnpm/linkify-it@5.0.0/node_modules/linkify-it/lib/re.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it-abbr@2.0.0/node_modules/markdown-it-abbr/index.cjs +94 -0
- package/dist/node_modules/.pnpm/markdown-it-abbr@2.0.0/node_modules/markdown-it-abbr/index.mjs +94 -0
- package/dist/node_modules/.pnpm/markdown-it-abbr@2.0.0/node_modules/markdown-it-abbr/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it-container@4.0.0/node_modules/markdown-it-container/index.cjs +78 -0
- package/dist/node_modules/.pnpm/markdown-it-container@4.0.0/node_modules/markdown-it-container/index.mjs +78 -0
- package/dist/node_modules/.pnpm/markdown-it-container@4.0.0/node_modules/markdown-it-container/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it-deflist@3.0.0/node_modules/markdown-it-deflist/index.cjs +123 -0
- package/dist/node_modules/.pnpm/markdown-it-deflist@3.0.0/node_modules/markdown-it-deflist/index.mjs +123 -0
- package/dist/node_modules/.pnpm/markdown-it-deflist@3.0.0/node_modules/markdown-it-deflist/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it-footnote@4.0.0/node_modules/markdown-it-footnote/index.cjs +246 -0
- package/dist/node_modules/.pnpm/markdown-it-footnote@4.0.0/node_modules/markdown-it-footnote/index.mjs +244 -0
- package/dist/node_modules/.pnpm/markdown-it-footnote@4.0.0/node_modules/markdown-it-footnote/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it-ins@4.0.0/node_modules/markdown-it-ins/index.cjs +80 -0
- package/dist/node_modules/.pnpm/markdown-it-ins@4.0.0/node_modules/markdown-it-ins/index.mjs +80 -0
- package/dist/node_modules/.pnpm/markdown-it-ins@4.0.0/node_modules/markdown-it-ins/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it-mark@4.0.0/node_modules/markdown-it-mark/index.cjs +80 -0
- package/dist/node_modules/.pnpm/markdown-it-mark@4.0.0/node_modules/markdown-it-mark/index.mjs +80 -0
- package/dist/node_modules/.pnpm/markdown-it-mark@4.0.0/node_modules/markdown-it-mark/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it-sub@2.0.0/node_modules/markdown-it-sub/index.cjs +45 -0
- package/dist/node_modules/.pnpm/markdown-it-sub@2.0.0/node_modules/markdown-it-sub/index.mjs +45 -0
- package/dist/node_modules/.pnpm/markdown-it-sub@2.0.0/node_modules/markdown-it-sub/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it-sup@2.0.0/node_modules/markdown-it-sup/index.cjs +45 -0
- package/dist/node_modules/.pnpm/markdown-it-sup@2.0.0/node_modules/markdown-it-sup/index.mjs +45 -0
- package/dist/node_modules/.pnpm/markdown-it-sup@2.0.0/node_modules/markdown-it-sup/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it-task-lists@2.1.1/node_modules/markdown-it-task-lists/index.cjs +94 -0
- package/dist/node_modules/.pnpm/markdown-it-task-lists@2.1.1/node_modules/markdown-it-task-lists/index.mjs +92 -0
- package/dist/node_modules/.pnpm/markdown-it-task-lists@2.1.1/node_modules/markdown-it-task-lists/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/index.cjs +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/index.mjs +3 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/common/html_blocks.cjs +69 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/common/html_blocks.mjs +69 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/common/html_blocks.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/common/html_re.cjs +9 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/common/html_re.mjs +8 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/common/html_re.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/common/utils.cjs +205 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/common/utils.mjs +189 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/common/utils.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/helpers/index.cjs +19 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/helpers/index.mjs +15 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/helpers/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/helpers/parse_link_destination.cjs +61 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/helpers/parse_link_destination.mjs +62 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/helpers/parse_link_destination.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/helpers/parse_link_label.cjs +35 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/helpers/parse_link_label.mjs +35 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/helpers/parse_link_label.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/helpers/parse_link_title.cjs +43 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/helpers/parse_link_title.mjs +44 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/helpers/parse_link_title.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/index.cjs +488 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/index.mjs +489 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/parser_block.cjs +148 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/parser_block.mjs +149 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/parser_block.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/parser_core.cjs +51 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/parser_core.mjs +52 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/parser_core.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/parser_inline.cjs +126 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/parser_inline.mjs +127 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/parser_inline.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/presets/commonmark.cjs +57 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/presets/commonmark.mjs +57 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/presets/commonmark.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/presets/default.cjs +23 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/presets/default.mjs +23 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/presets/default.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/presets/zero.cjs +31 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/presets/zero.mjs +31 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/presets/zero.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/renderer.cjs +217 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/renderer.mjs +218 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/renderer.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/ruler.cjs +274 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/ruler.mjs +274 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/ruler.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/blockquote.cjs +107 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/blockquote.mjs +108 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/blockquote.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/code.cjs +27 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/code.mjs +27 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/code.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/fence.cjs +48 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/fence.mjs +48 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/fence.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/heading.cjs +35 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/heading.mjs +36 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/heading.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/hr.cjs +26 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/hr.mjs +27 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/hr.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/html_block.cjs +72 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/html_block.mjs +73 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/html_block.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/lheading.cjs +53 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/lheading.mjs +53 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/lheading.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/list.cjs +157 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/list.mjs +158 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/list.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/paragraph.cjs +32 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/paragraph.mjs +32 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/paragraph.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/reference.cjs +140 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/reference.mjs +141 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/reference.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/state_block.cjs +112 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/state_block.mjs +113 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/state_block.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/table.cjs +139 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/table.mjs +140 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_block/table.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_core/block.cjs +15 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_core/block.mjs +15 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_core/block.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_core/inline.cjs +12 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_core/inline.mjs +12 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_core/inline.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_core/linkify.cjs +81 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_core/linkify.mjs +82 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_core/linkify.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_core/normalize.cjs +13 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_core/normalize.mjs +13 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_core/normalize.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_core/replacements.cjs +45 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_core/replacements.mjs +45 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_core/replacements.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_core/smartquotes.cjs +112 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_core/smartquotes.mjs +113 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_core/smartquotes.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_core/state_core.cjs +14 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_core/state_core.mjs +15 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_core/state_core.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_core/text_join.cjs +22 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_core/text_join.mjs +22 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_core/text_join.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/autolink.cjs +55 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/autolink.mjs +55 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/autolink.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/backticks.cjs +41 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/backticks.mjs +41 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/backticks.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/balance_pairs.cjs +62 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/balance_pairs.mjs +62 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/balance_pairs.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/emphasis.cjs +64 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/emphasis.mjs +64 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/emphasis.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/entity.cjs +45 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/entity.mjs +46 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/entity.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/escape.cjs +48 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/escape.mjs +49 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/escape.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/fragments_join.cjs +22 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/fragments_join.mjs +22 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/fragments_join.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/html_inline.cjs +34 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/html_inline.mjs +35 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/html_inline.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/image.cjs +82 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/image.mjs +83 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/image.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/link.cjs +84 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/link.mjs +85 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/link.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/linkify.cjs +42 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/linkify.mjs +42 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/linkify.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/newline.cjs +26 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/newline.mjs +27 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/newline.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/state_inline.cjs +74 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/state_inline.mjs +75 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/state_inline.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/strikethrough.cjs +80 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/strikethrough.mjs +80 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/strikethrough.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/text.cjs +41 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/text.mjs +41 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/rules_inline/text.mjs.map +1 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/token.cjs +157 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/token.mjs +157 -0
- package/dist/node_modules/.pnpm/markdown-it@14.1.1/node_modules/markdown-it/lib/token.mjs.map +1 -0
- package/dist/node_modules/.pnpm/mdurl@2.0.0/node_modules/mdurl/index.cjs +21 -0
- package/dist/node_modules/.pnpm/mdurl@2.0.0/node_modules/mdurl/index.mjs +17 -0
- package/dist/node_modules/.pnpm/mdurl@2.0.0/node_modules/mdurl/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/mdurl@2.0.0/node_modules/mdurl/lib/decode.cjs +74 -0
- package/dist/node_modules/.pnpm/mdurl@2.0.0/node_modules/mdurl/lib/decode.mjs +74 -0
- package/dist/node_modules/.pnpm/mdurl@2.0.0/node_modules/mdurl/lib/decode.mjs.map +1 -0
- package/dist/node_modules/.pnpm/mdurl@2.0.0/node_modules/mdurl/lib/encode.cjs +57 -0
- package/dist/node_modules/.pnpm/mdurl@2.0.0/node_modules/mdurl/lib/encode.mjs +57 -0
- package/dist/node_modules/.pnpm/mdurl@2.0.0/node_modules/mdurl/lib/encode.mjs.map +1 -0
- package/dist/node_modules/.pnpm/mdurl@2.0.0/node_modules/mdurl/lib/format.cjs +18 -0
- package/dist/node_modules/.pnpm/mdurl@2.0.0/node_modules/mdurl/lib/format.mjs +18 -0
- package/dist/node_modules/.pnpm/mdurl@2.0.0/node_modules/mdurl/lib/format.mjs.map +1 -0
- package/dist/node_modules/.pnpm/mdurl@2.0.0/node_modules/mdurl/lib/parse.cjs +175 -0
- package/dist/node_modules/.pnpm/mdurl@2.0.0/node_modules/mdurl/lib/parse.mjs +175 -0
- package/dist/node_modules/.pnpm/mdurl@2.0.0/node_modules/mdurl/lib/parse.mjs.map +1 -0
- package/dist/node_modules/.pnpm/normalize-html-whitespace@1.0.0/node_modules/normalize-html-whitespace/index.cjs +19 -0
- package/dist/node_modules/.pnpm/normalize-html-whitespace@1.0.0/node_modules/normalize-html-whitespace/index.mjs +15 -0
- package/dist/node_modules/.pnpm/normalize-html-whitespace@1.0.0/node_modules/normalize-html-whitespace/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/common/doctype.cjs +104 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/common/doctype.mjs +104 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/common/doctype.mjs.map +1 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/common/error-codes.cjs +73 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/common/error-codes.mjs +68 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/common/error-codes.mjs.map +1 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/common/foreign-content.cjs +266 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/common/foreign-content.mjs +262 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/common/foreign-content.mjs.map +1 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/common/html.cjs +575 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/common/html.mjs +543 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/common/html.mjs.map +1 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/common/token.cjs +27 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/common/token.mjs +21 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/common/token.mjs.map +1 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/common/unicode.cjs +105 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/common/unicode.mjs +94 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/common/unicode.mjs.map +1 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/index.cjs +33 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/index.mjs +34 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/parser/formatting-element-list.cjs +99 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/parser/formatting-element-list.mjs +93 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/parser/formatting-element-list.mjs.map +1 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/parser/index.cjs +2544 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/parser/index.mjs +2545 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/parser/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/parser/open-element-stack.cjs +296 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/parser/open-element-stack.mjs +297 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/parser/open-element-stack.mjs.map +1 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/serializer/index.cjs +26 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/serializer/index.mjs +28 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/serializer/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/tokenizer/index.cjs +2069 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/tokenizer/index.mjs +2069 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/tokenizer/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/tokenizer/preprocessor.cjs +156 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/tokenizer/preprocessor.mjs +157 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/tokenizer/preprocessor.mjs.map +1 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/tree-adapters/default.cjs +166 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/tree-adapters/default.mjs +167 -0
- package/dist/node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/tree-adapters/default.mjs.map +1 -0
- package/dist/node_modules/.pnpm/punycode.js@2.3.1/node_modules/punycode.js/punycode.cjs +299 -0
- package/dist/node_modules/.pnpm/punycode.js@2.3.1/node_modules/punycode.js/punycode.mjs +295 -0
- package/dist/node_modules/.pnpm/punycode.js@2.3.1/node_modules/punycode.js/punycode.mjs.map +1 -0
- package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/categories/Cc/regex.cjs +6 -0
- package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/categories/Cc/regex.mjs +6 -0
- package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/categories/Cc/regex.mjs.map +1 -0
- package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/categories/Cf/regex.cjs +6 -0
- package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/categories/Cf/regex.mjs +6 -0
- package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/categories/Cf/regex.mjs.map +1 -0
- package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/categories/P/regex.cjs +6 -0
- package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/categories/P/regex.mjs +6 -0
- package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/categories/P/regex.mjs.map +1 -0
- package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/categories/S/regex.cjs +6 -0
- package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/categories/S/regex.mjs +6 -0
- package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/categories/S/regex.mjs.map +1 -0
- package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/categories/Z/regex.cjs +6 -0
- package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/categories/Z/regex.mjs +6 -0
- package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/categories/Z/regex.mjs.map +1 -0
- package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/index.cjs +25 -0
- package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/index.mjs +21 -0
- package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/properties/Any/regex.cjs +6 -0
- package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/properties/Any/regex.mjs +6 -0
- package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/properties/Any/regex.mjs.map +1 -0
- package/dist/node_modules/.pnpm/wrap-ansi@10.0.0/node_modules/wrap-ansi/index.cjs +15 -0
- package/dist/node_modules/.pnpm/wrap-ansi@10.0.0/node_modules/wrap-ansi/index.mjs +17 -0
- package/dist/node_modules/.pnpm/wrap-ansi@10.0.0/node_modules/wrap-ansi/index.mjs.map +1 -0
- package/dist/{plugin-changelog → packages/plugin-changelog}/dist/components/changelog-command.cjs +5 -4
- package/dist/packages/plugin-changelog/dist/components/changelog-command.mjs +4 -3
- package/dist/packages/plugin-changelog/dist/components/changelog-command.mjs.map +1 -1
- package/dist/{plugin-changelog → packages/plugin-changelog}/dist/index.cjs +1 -1
- package/dist/packages/unified/dist/html-DzncQodH.cjs +156 -0
- package/dist/packages/unified/dist/html-DzncQodH.mjs +157 -0
- package/dist/packages/unified/dist/html-DzncQodH.mjs.map +1 -0
- package/dist/packages/unified/dist/markdown/index.cjs +1 -0
- package/dist/packages/unified/dist/markdown/index.mjs +3 -0
- package/dist/packages/unified/dist/markdown-BiaU4FQg.cjs +82 -0
- package/dist/packages/unified/dist/markdown-BiaU4FQg.mjs +83 -0
- package/dist/packages/unified/dist/markdown-BiaU4FQg.mjs.map +1 -0
- package/package.json +35 -12
- package/dist/packages/unified/dist/markdown-Bs-BRrSC.mjs +0 -10
- package/dist/packages/unified/dist/markdown-Bs-BRrSC.mjs.map +0 -1
- package/dist/unified/dist/markdown-Bs-BRrSC.cjs +0 -10
- /package/dist/{plugin-changelog → packages/plugin-changelog}/dist/components/index.cjs +0 -0
|
@@ -0,0 +1,2544 @@
|
|
|
1
|
+
const require_unicode = require('../common/unicode.cjs');
|
|
2
|
+
const require_error_codes = require('../common/error-codes.cjs');
|
|
3
|
+
const require_token = require('../common/token.cjs');
|
|
4
|
+
const require_html = require('../common/html.cjs');
|
|
5
|
+
const require_index = require('../tokenizer/index.cjs');
|
|
6
|
+
const require_open_element_stack = require('./open-element-stack.cjs');
|
|
7
|
+
const require_formatting_element_list = require('./formatting-element-list.cjs');
|
|
8
|
+
const require_default = require('../tree-adapters/default.cjs');
|
|
9
|
+
const require_doctype = require('../common/doctype.cjs');
|
|
10
|
+
const require_foreign_content = require('../common/foreign-content.cjs');
|
|
11
|
+
|
|
12
|
+
//#region ../../node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/parser/index.js
|
|
13
|
+
const HIDDEN_INPUT_TYPE = "hidden";
|
|
14
|
+
const AA_OUTER_LOOP_ITER = 8;
|
|
15
|
+
const AA_INNER_LOOP_ITER = 3;
|
|
16
|
+
var InsertionMode;
|
|
17
|
+
(function(InsertionMode) {
|
|
18
|
+
InsertionMode[InsertionMode["INITIAL"] = 0] = "INITIAL";
|
|
19
|
+
InsertionMode[InsertionMode["BEFORE_HTML"] = 1] = "BEFORE_HTML";
|
|
20
|
+
InsertionMode[InsertionMode["BEFORE_HEAD"] = 2] = "BEFORE_HEAD";
|
|
21
|
+
InsertionMode[InsertionMode["IN_HEAD"] = 3] = "IN_HEAD";
|
|
22
|
+
InsertionMode[InsertionMode["IN_HEAD_NO_SCRIPT"] = 4] = "IN_HEAD_NO_SCRIPT";
|
|
23
|
+
InsertionMode[InsertionMode["AFTER_HEAD"] = 5] = "AFTER_HEAD";
|
|
24
|
+
InsertionMode[InsertionMode["IN_BODY"] = 6] = "IN_BODY";
|
|
25
|
+
InsertionMode[InsertionMode["TEXT"] = 7] = "TEXT";
|
|
26
|
+
InsertionMode[InsertionMode["IN_TABLE"] = 8] = "IN_TABLE";
|
|
27
|
+
InsertionMode[InsertionMode["IN_TABLE_TEXT"] = 9] = "IN_TABLE_TEXT";
|
|
28
|
+
InsertionMode[InsertionMode["IN_CAPTION"] = 10] = "IN_CAPTION";
|
|
29
|
+
InsertionMode[InsertionMode["IN_COLUMN_GROUP"] = 11] = "IN_COLUMN_GROUP";
|
|
30
|
+
InsertionMode[InsertionMode["IN_TABLE_BODY"] = 12] = "IN_TABLE_BODY";
|
|
31
|
+
InsertionMode[InsertionMode["IN_ROW"] = 13] = "IN_ROW";
|
|
32
|
+
InsertionMode[InsertionMode["IN_CELL"] = 14] = "IN_CELL";
|
|
33
|
+
InsertionMode[InsertionMode["IN_SELECT"] = 15] = "IN_SELECT";
|
|
34
|
+
InsertionMode[InsertionMode["IN_SELECT_IN_TABLE"] = 16] = "IN_SELECT_IN_TABLE";
|
|
35
|
+
InsertionMode[InsertionMode["IN_TEMPLATE"] = 17] = "IN_TEMPLATE";
|
|
36
|
+
InsertionMode[InsertionMode["AFTER_BODY"] = 18] = "AFTER_BODY";
|
|
37
|
+
InsertionMode[InsertionMode["IN_FRAMESET"] = 19] = "IN_FRAMESET";
|
|
38
|
+
InsertionMode[InsertionMode["AFTER_FRAMESET"] = 20] = "AFTER_FRAMESET";
|
|
39
|
+
InsertionMode[InsertionMode["AFTER_AFTER_BODY"] = 21] = "AFTER_AFTER_BODY";
|
|
40
|
+
InsertionMode[InsertionMode["AFTER_AFTER_FRAMESET"] = 22] = "AFTER_AFTER_FRAMESET";
|
|
41
|
+
})(InsertionMode || (InsertionMode = {}));
|
|
42
|
+
const BASE_LOC = {
|
|
43
|
+
startLine: -1,
|
|
44
|
+
startCol: -1,
|
|
45
|
+
startOffset: -1,
|
|
46
|
+
endLine: -1,
|
|
47
|
+
endCol: -1,
|
|
48
|
+
endOffset: -1
|
|
49
|
+
};
|
|
50
|
+
const TABLE_STRUCTURE_TAGS = new Set([
|
|
51
|
+
require_html.TAG_ID.TABLE,
|
|
52
|
+
require_html.TAG_ID.TBODY,
|
|
53
|
+
require_html.TAG_ID.TFOOT,
|
|
54
|
+
require_html.TAG_ID.THEAD,
|
|
55
|
+
require_html.TAG_ID.TR
|
|
56
|
+
]);
|
|
57
|
+
const defaultParserOptions = {
|
|
58
|
+
scriptingEnabled: true,
|
|
59
|
+
sourceCodeLocationInfo: false,
|
|
60
|
+
treeAdapter: require_default.defaultTreeAdapter,
|
|
61
|
+
onParseError: null
|
|
62
|
+
};
|
|
63
|
+
var Parser = class {
|
|
64
|
+
constructor(options, document, fragmentContext = null, scriptHandler = null) {
|
|
65
|
+
this.fragmentContext = fragmentContext;
|
|
66
|
+
this.scriptHandler = scriptHandler;
|
|
67
|
+
this.currentToken = null;
|
|
68
|
+
this.stopped = false;
|
|
69
|
+
/** @internal */
|
|
70
|
+
this.insertionMode = InsertionMode.INITIAL;
|
|
71
|
+
/** @internal */
|
|
72
|
+
this.originalInsertionMode = InsertionMode.INITIAL;
|
|
73
|
+
/** @internal */
|
|
74
|
+
this.headElement = null;
|
|
75
|
+
/** @internal */
|
|
76
|
+
this.formElement = null;
|
|
77
|
+
/** Indicates that the current node is not an element in the HTML namespace */
|
|
78
|
+
this.currentNotInHTML = false;
|
|
79
|
+
/**
|
|
80
|
+
* The template insertion mode stack is maintained from the left.
|
|
81
|
+
* Ie. the topmost element will always have index 0.
|
|
82
|
+
*
|
|
83
|
+
* @internal
|
|
84
|
+
*/
|
|
85
|
+
this.tmplInsertionModeStack = [];
|
|
86
|
+
/** @internal */
|
|
87
|
+
this.pendingCharacterTokens = [];
|
|
88
|
+
/** @internal */
|
|
89
|
+
this.hasNonWhitespacePendingCharacterToken = false;
|
|
90
|
+
/** @internal */
|
|
91
|
+
this.framesetOk = true;
|
|
92
|
+
/** @internal */
|
|
93
|
+
this.skipNextNewLine = false;
|
|
94
|
+
/** @internal */
|
|
95
|
+
this.fosterParentingEnabled = false;
|
|
96
|
+
this.options = {
|
|
97
|
+
...defaultParserOptions,
|
|
98
|
+
...options
|
|
99
|
+
};
|
|
100
|
+
this.treeAdapter = this.options.treeAdapter;
|
|
101
|
+
this.onParseError = this.options.onParseError;
|
|
102
|
+
if (this.onParseError) this.options.sourceCodeLocationInfo = true;
|
|
103
|
+
this.document = document !== null && document !== void 0 ? document : this.treeAdapter.createDocument();
|
|
104
|
+
this.tokenizer = new require_index.Tokenizer(this.options, this);
|
|
105
|
+
this.activeFormattingElements = new require_formatting_element_list.FormattingElementList(this.treeAdapter);
|
|
106
|
+
this.fragmentContextID = fragmentContext ? require_html.getTagID(this.treeAdapter.getTagName(fragmentContext)) : require_html.TAG_ID.UNKNOWN;
|
|
107
|
+
this._setContextModes(fragmentContext !== null && fragmentContext !== void 0 ? fragmentContext : this.document, this.fragmentContextID);
|
|
108
|
+
this.openElements = new require_open_element_stack.OpenElementStack(this.document, this.treeAdapter, this);
|
|
109
|
+
}
|
|
110
|
+
static parse(html, options) {
|
|
111
|
+
const parser = new this(options);
|
|
112
|
+
parser.tokenizer.write(html, true);
|
|
113
|
+
return parser.document;
|
|
114
|
+
}
|
|
115
|
+
static getFragmentParser(fragmentContext, options) {
|
|
116
|
+
const opts = {
|
|
117
|
+
...defaultParserOptions,
|
|
118
|
+
...options
|
|
119
|
+
};
|
|
120
|
+
fragmentContext !== null && fragmentContext !== void 0 || (fragmentContext = opts.treeAdapter.createElement(require_html.TAG_NAMES.TEMPLATE, require_html.NS.HTML, []));
|
|
121
|
+
const documentMock = opts.treeAdapter.createElement("documentmock", require_html.NS.HTML, []);
|
|
122
|
+
const parser = new this(opts, documentMock, fragmentContext);
|
|
123
|
+
if (parser.fragmentContextID === require_html.TAG_ID.TEMPLATE) parser.tmplInsertionModeStack.unshift(InsertionMode.IN_TEMPLATE);
|
|
124
|
+
parser._initTokenizerForFragmentParsing();
|
|
125
|
+
parser._insertFakeRootElement();
|
|
126
|
+
parser._resetInsertionMode();
|
|
127
|
+
parser._findFormInFragmentContext();
|
|
128
|
+
return parser;
|
|
129
|
+
}
|
|
130
|
+
getFragment() {
|
|
131
|
+
const rootElement = this.treeAdapter.getFirstChild(this.document);
|
|
132
|
+
const fragment = this.treeAdapter.createDocumentFragment();
|
|
133
|
+
this._adoptNodes(rootElement, fragment);
|
|
134
|
+
return fragment;
|
|
135
|
+
}
|
|
136
|
+
/** @internal */
|
|
137
|
+
_err(token, code, beforeToken) {
|
|
138
|
+
var _a;
|
|
139
|
+
if (!this.onParseError) return;
|
|
140
|
+
const loc = (_a = token.location) !== null && _a !== void 0 ? _a : BASE_LOC;
|
|
141
|
+
const err = {
|
|
142
|
+
code,
|
|
143
|
+
startLine: loc.startLine,
|
|
144
|
+
startCol: loc.startCol,
|
|
145
|
+
startOffset: loc.startOffset,
|
|
146
|
+
endLine: beforeToken ? loc.startLine : loc.endLine,
|
|
147
|
+
endCol: beforeToken ? loc.startCol : loc.endCol,
|
|
148
|
+
endOffset: beforeToken ? loc.startOffset : loc.endOffset
|
|
149
|
+
};
|
|
150
|
+
this.onParseError(err);
|
|
151
|
+
}
|
|
152
|
+
/** @internal */
|
|
153
|
+
onItemPush(node, tid, isTop) {
|
|
154
|
+
var _a, _b;
|
|
155
|
+
(_b = (_a = this.treeAdapter).onItemPush) === null || _b === void 0 || _b.call(_a, node);
|
|
156
|
+
if (isTop && this.openElements.stackTop > 0) this._setContextModes(node, tid);
|
|
157
|
+
}
|
|
158
|
+
/** @internal */
|
|
159
|
+
onItemPop(node, isTop) {
|
|
160
|
+
var _a, _b;
|
|
161
|
+
if (this.options.sourceCodeLocationInfo) this._setEndLocation(node, this.currentToken);
|
|
162
|
+
(_b = (_a = this.treeAdapter).onItemPop) === null || _b === void 0 || _b.call(_a, node, this.openElements.current);
|
|
163
|
+
if (isTop) {
|
|
164
|
+
let current;
|
|
165
|
+
let currentTagId;
|
|
166
|
+
if (this.openElements.stackTop === 0 && this.fragmentContext) {
|
|
167
|
+
current = this.fragmentContext;
|
|
168
|
+
currentTagId = this.fragmentContextID;
|
|
169
|
+
} else ({current, currentTagId} = this.openElements);
|
|
170
|
+
this._setContextModes(current, currentTagId);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
_setContextModes(current, tid) {
|
|
174
|
+
const isHTML = current === this.document || current && this.treeAdapter.getNamespaceURI(current) === require_html.NS.HTML;
|
|
175
|
+
this.currentNotInHTML = !isHTML;
|
|
176
|
+
this.tokenizer.inForeignNode = !isHTML && current !== void 0 && tid !== void 0 && !this._isIntegrationPoint(tid, current);
|
|
177
|
+
}
|
|
178
|
+
/** @protected */
|
|
179
|
+
_switchToTextParsing(currentToken, nextTokenizerState) {
|
|
180
|
+
this._insertElement(currentToken, require_html.NS.HTML);
|
|
181
|
+
this.tokenizer.state = nextTokenizerState;
|
|
182
|
+
this.originalInsertionMode = this.insertionMode;
|
|
183
|
+
this.insertionMode = InsertionMode.TEXT;
|
|
184
|
+
}
|
|
185
|
+
switchToPlaintextParsing() {
|
|
186
|
+
this.insertionMode = InsertionMode.TEXT;
|
|
187
|
+
this.originalInsertionMode = InsertionMode.IN_BODY;
|
|
188
|
+
this.tokenizer.state = require_index.TokenizerMode.PLAINTEXT;
|
|
189
|
+
}
|
|
190
|
+
/** @protected */
|
|
191
|
+
_getAdjustedCurrentElement() {
|
|
192
|
+
return this.openElements.stackTop === 0 && this.fragmentContext ? this.fragmentContext : this.openElements.current;
|
|
193
|
+
}
|
|
194
|
+
/** @protected */
|
|
195
|
+
_findFormInFragmentContext() {
|
|
196
|
+
let node = this.fragmentContext;
|
|
197
|
+
while (node) {
|
|
198
|
+
if (this.treeAdapter.getTagName(node) === require_html.TAG_NAMES.FORM) {
|
|
199
|
+
this.formElement = node;
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
node = this.treeAdapter.getParentNode(node);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
_initTokenizerForFragmentParsing() {
|
|
206
|
+
if (!this.fragmentContext || this.treeAdapter.getNamespaceURI(this.fragmentContext) !== require_html.NS.HTML) return;
|
|
207
|
+
switch (this.fragmentContextID) {
|
|
208
|
+
case require_html.TAG_ID.TITLE:
|
|
209
|
+
case require_html.TAG_ID.TEXTAREA:
|
|
210
|
+
this.tokenizer.state = require_index.TokenizerMode.RCDATA;
|
|
211
|
+
break;
|
|
212
|
+
case require_html.TAG_ID.STYLE:
|
|
213
|
+
case require_html.TAG_ID.XMP:
|
|
214
|
+
case require_html.TAG_ID.IFRAME:
|
|
215
|
+
case require_html.TAG_ID.NOEMBED:
|
|
216
|
+
case require_html.TAG_ID.NOFRAMES:
|
|
217
|
+
case require_html.TAG_ID.NOSCRIPT:
|
|
218
|
+
this.tokenizer.state = require_index.TokenizerMode.RAWTEXT;
|
|
219
|
+
break;
|
|
220
|
+
case require_html.TAG_ID.SCRIPT:
|
|
221
|
+
this.tokenizer.state = require_index.TokenizerMode.SCRIPT_DATA;
|
|
222
|
+
break;
|
|
223
|
+
case require_html.TAG_ID.PLAINTEXT:
|
|
224
|
+
this.tokenizer.state = require_index.TokenizerMode.PLAINTEXT;
|
|
225
|
+
break;
|
|
226
|
+
default:
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
/** @protected */
|
|
230
|
+
_setDocumentType(token) {
|
|
231
|
+
const name = token.name || "";
|
|
232
|
+
const publicId = token.publicId || "";
|
|
233
|
+
const systemId = token.systemId || "";
|
|
234
|
+
this.treeAdapter.setDocumentType(this.document, name, publicId, systemId);
|
|
235
|
+
if (token.location) {
|
|
236
|
+
const docTypeNode = this.treeAdapter.getChildNodes(this.document).find((node) => this.treeAdapter.isDocumentTypeNode(node));
|
|
237
|
+
if (docTypeNode) this.treeAdapter.setNodeSourceCodeLocation(docTypeNode, token.location);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
/** @protected */
|
|
241
|
+
_attachElementToTree(element, location) {
|
|
242
|
+
if (this.options.sourceCodeLocationInfo) {
|
|
243
|
+
const loc = location && {
|
|
244
|
+
...location,
|
|
245
|
+
startTag: location
|
|
246
|
+
};
|
|
247
|
+
this.treeAdapter.setNodeSourceCodeLocation(element, loc);
|
|
248
|
+
}
|
|
249
|
+
if (this._shouldFosterParentOnInsertion()) this._fosterParentElement(element);
|
|
250
|
+
else {
|
|
251
|
+
const parent = this.openElements.currentTmplContentOrNode;
|
|
252
|
+
this.treeAdapter.appendChild(parent !== null && parent !== void 0 ? parent : this.document, element);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* For self-closing tags. Add an element to the tree, but skip adding it
|
|
257
|
+
* to the stack.
|
|
258
|
+
*/
|
|
259
|
+
/** @protected */
|
|
260
|
+
_appendElement(token, namespaceURI) {
|
|
261
|
+
const element = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs);
|
|
262
|
+
this._attachElementToTree(element, token.location);
|
|
263
|
+
}
|
|
264
|
+
/** @protected */
|
|
265
|
+
_insertElement(token, namespaceURI) {
|
|
266
|
+
const element = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs);
|
|
267
|
+
this._attachElementToTree(element, token.location);
|
|
268
|
+
this.openElements.push(element, token.tagID);
|
|
269
|
+
}
|
|
270
|
+
/** @protected */
|
|
271
|
+
_insertFakeElement(tagName, tagID) {
|
|
272
|
+
const element = this.treeAdapter.createElement(tagName, require_html.NS.HTML, []);
|
|
273
|
+
this._attachElementToTree(element, null);
|
|
274
|
+
this.openElements.push(element, tagID);
|
|
275
|
+
}
|
|
276
|
+
/** @protected */
|
|
277
|
+
_insertTemplate(token) {
|
|
278
|
+
const tmpl = this.treeAdapter.createElement(token.tagName, require_html.NS.HTML, token.attrs);
|
|
279
|
+
const content = this.treeAdapter.createDocumentFragment();
|
|
280
|
+
this.treeAdapter.setTemplateContent(tmpl, content);
|
|
281
|
+
this._attachElementToTree(tmpl, token.location);
|
|
282
|
+
this.openElements.push(tmpl, token.tagID);
|
|
283
|
+
if (this.options.sourceCodeLocationInfo) this.treeAdapter.setNodeSourceCodeLocation(content, null);
|
|
284
|
+
}
|
|
285
|
+
/** @protected */
|
|
286
|
+
_insertFakeRootElement() {
|
|
287
|
+
const element = this.treeAdapter.createElement(require_html.TAG_NAMES.HTML, require_html.NS.HTML, []);
|
|
288
|
+
if (this.options.sourceCodeLocationInfo) this.treeAdapter.setNodeSourceCodeLocation(element, null);
|
|
289
|
+
this.treeAdapter.appendChild(this.openElements.current, element);
|
|
290
|
+
this.openElements.push(element, require_html.TAG_ID.HTML);
|
|
291
|
+
}
|
|
292
|
+
/** @protected */
|
|
293
|
+
_appendCommentNode(token, parent) {
|
|
294
|
+
const commentNode = this.treeAdapter.createCommentNode(token.data);
|
|
295
|
+
this.treeAdapter.appendChild(parent, commentNode);
|
|
296
|
+
if (this.options.sourceCodeLocationInfo) this.treeAdapter.setNodeSourceCodeLocation(commentNode, token.location);
|
|
297
|
+
}
|
|
298
|
+
/** @protected */
|
|
299
|
+
_insertCharacters(token) {
|
|
300
|
+
let parent;
|
|
301
|
+
let beforeElement;
|
|
302
|
+
if (this._shouldFosterParentOnInsertion()) {
|
|
303
|
+
({parent, beforeElement} = this._findFosterParentingLocation());
|
|
304
|
+
if (beforeElement) this.treeAdapter.insertTextBefore(parent, token.chars, beforeElement);
|
|
305
|
+
else this.treeAdapter.insertText(parent, token.chars);
|
|
306
|
+
} else {
|
|
307
|
+
parent = this.openElements.currentTmplContentOrNode;
|
|
308
|
+
this.treeAdapter.insertText(parent, token.chars);
|
|
309
|
+
}
|
|
310
|
+
if (!token.location) return;
|
|
311
|
+
const siblings = this.treeAdapter.getChildNodes(parent);
|
|
312
|
+
const textNode = siblings[(beforeElement ? siblings.lastIndexOf(beforeElement) : siblings.length) - 1];
|
|
313
|
+
if (this.treeAdapter.getNodeSourceCodeLocation(textNode)) {
|
|
314
|
+
const { endLine, endCol, endOffset } = token.location;
|
|
315
|
+
this.treeAdapter.updateNodeSourceCodeLocation(textNode, {
|
|
316
|
+
endLine,
|
|
317
|
+
endCol,
|
|
318
|
+
endOffset
|
|
319
|
+
});
|
|
320
|
+
} else if (this.options.sourceCodeLocationInfo) this.treeAdapter.setNodeSourceCodeLocation(textNode, token.location);
|
|
321
|
+
}
|
|
322
|
+
/** @protected */
|
|
323
|
+
_adoptNodes(donor, recipient) {
|
|
324
|
+
for (let child = this.treeAdapter.getFirstChild(donor); child; child = this.treeAdapter.getFirstChild(donor)) {
|
|
325
|
+
this.treeAdapter.detachNode(child);
|
|
326
|
+
this.treeAdapter.appendChild(recipient, child);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
/** @protected */
|
|
330
|
+
_setEndLocation(element, closingToken) {
|
|
331
|
+
if (this.treeAdapter.getNodeSourceCodeLocation(element) && closingToken.location) {
|
|
332
|
+
const ctLoc = closingToken.location;
|
|
333
|
+
const tn = this.treeAdapter.getTagName(element);
|
|
334
|
+
const endLoc = closingToken.type === require_token.TokenType.END_TAG && tn === closingToken.tagName ? {
|
|
335
|
+
endTag: { ...ctLoc },
|
|
336
|
+
endLine: ctLoc.endLine,
|
|
337
|
+
endCol: ctLoc.endCol,
|
|
338
|
+
endOffset: ctLoc.endOffset
|
|
339
|
+
} : {
|
|
340
|
+
endLine: ctLoc.startLine,
|
|
341
|
+
endCol: ctLoc.startCol,
|
|
342
|
+
endOffset: ctLoc.startOffset
|
|
343
|
+
};
|
|
344
|
+
this.treeAdapter.updateNodeSourceCodeLocation(element, endLoc);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
shouldProcessStartTagTokenInForeignContent(token) {
|
|
348
|
+
if (!this.currentNotInHTML) return false;
|
|
349
|
+
let current;
|
|
350
|
+
let currentTagId;
|
|
351
|
+
if (this.openElements.stackTop === 0 && this.fragmentContext) {
|
|
352
|
+
current = this.fragmentContext;
|
|
353
|
+
currentTagId = this.fragmentContextID;
|
|
354
|
+
} else ({current, currentTagId} = this.openElements);
|
|
355
|
+
if (token.tagID === require_html.TAG_ID.SVG && this.treeAdapter.getTagName(current) === require_html.TAG_NAMES.ANNOTATION_XML && this.treeAdapter.getNamespaceURI(current) === require_html.NS.MATHML) return false;
|
|
356
|
+
return this.tokenizer.inForeignNode || (token.tagID === require_html.TAG_ID.MGLYPH || token.tagID === require_html.TAG_ID.MALIGNMARK) && currentTagId !== void 0 && !this._isIntegrationPoint(currentTagId, current, require_html.NS.HTML);
|
|
357
|
+
}
|
|
358
|
+
/** @protected */
|
|
359
|
+
_processToken(token) {
|
|
360
|
+
switch (token.type) {
|
|
361
|
+
case require_token.TokenType.CHARACTER:
|
|
362
|
+
this.onCharacter(token);
|
|
363
|
+
break;
|
|
364
|
+
case require_token.TokenType.NULL_CHARACTER:
|
|
365
|
+
this.onNullCharacter(token);
|
|
366
|
+
break;
|
|
367
|
+
case require_token.TokenType.COMMENT:
|
|
368
|
+
this.onComment(token);
|
|
369
|
+
break;
|
|
370
|
+
case require_token.TokenType.DOCTYPE:
|
|
371
|
+
this.onDoctype(token);
|
|
372
|
+
break;
|
|
373
|
+
case require_token.TokenType.START_TAG:
|
|
374
|
+
this._processStartTag(token);
|
|
375
|
+
break;
|
|
376
|
+
case require_token.TokenType.END_TAG:
|
|
377
|
+
this.onEndTag(token);
|
|
378
|
+
break;
|
|
379
|
+
case require_token.TokenType.EOF:
|
|
380
|
+
this.onEof(token);
|
|
381
|
+
break;
|
|
382
|
+
case require_token.TokenType.WHITESPACE_CHARACTER:
|
|
383
|
+
this.onWhitespaceCharacter(token);
|
|
384
|
+
break;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
/** @protected */
|
|
388
|
+
_isIntegrationPoint(tid, element, foreignNS) {
|
|
389
|
+
const ns = this.treeAdapter.getNamespaceURI(element);
|
|
390
|
+
const attrs = this.treeAdapter.getAttrList(element);
|
|
391
|
+
return require_foreign_content.isIntegrationPoint(tid, ns, attrs, foreignNS);
|
|
392
|
+
}
|
|
393
|
+
/** @protected */
|
|
394
|
+
_reconstructActiveFormattingElements() {
|
|
395
|
+
const listLength = this.activeFormattingElements.entries.length;
|
|
396
|
+
if (listLength) {
|
|
397
|
+
const endIndex = this.activeFormattingElements.entries.findIndex((entry) => entry.type === require_formatting_element_list.EntryType.Marker || this.openElements.contains(entry.element));
|
|
398
|
+
const unopenIdx = endIndex === -1 ? listLength - 1 : endIndex - 1;
|
|
399
|
+
for (let i = unopenIdx; i >= 0; i--) {
|
|
400
|
+
const entry = this.activeFormattingElements.entries[i];
|
|
401
|
+
this._insertElement(entry.token, this.treeAdapter.getNamespaceURI(entry.element));
|
|
402
|
+
entry.element = this.openElements.current;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
/** @protected */
|
|
407
|
+
_closeTableCell() {
|
|
408
|
+
this.openElements.generateImpliedEndTags();
|
|
409
|
+
this.openElements.popUntilTableCellPopped();
|
|
410
|
+
this.activeFormattingElements.clearToLastMarker();
|
|
411
|
+
this.insertionMode = InsertionMode.IN_ROW;
|
|
412
|
+
}
|
|
413
|
+
/** @protected */
|
|
414
|
+
_closePElement() {
|
|
415
|
+
this.openElements.generateImpliedEndTagsWithExclusion(require_html.TAG_ID.P);
|
|
416
|
+
this.openElements.popUntilTagNamePopped(require_html.TAG_ID.P);
|
|
417
|
+
}
|
|
418
|
+
/** @protected */
|
|
419
|
+
_resetInsertionMode() {
|
|
420
|
+
for (let i = this.openElements.stackTop; i >= 0; i--) switch (i === 0 && this.fragmentContext ? this.fragmentContextID : this.openElements.tagIDs[i]) {
|
|
421
|
+
case require_html.TAG_ID.TR:
|
|
422
|
+
this.insertionMode = InsertionMode.IN_ROW;
|
|
423
|
+
return;
|
|
424
|
+
case require_html.TAG_ID.TBODY:
|
|
425
|
+
case require_html.TAG_ID.THEAD:
|
|
426
|
+
case require_html.TAG_ID.TFOOT:
|
|
427
|
+
this.insertionMode = InsertionMode.IN_TABLE_BODY;
|
|
428
|
+
return;
|
|
429
|
+
case require_html.TAG_ID.CAPTION:
|
|
430
|
+
this.insertionMode = InsertionMode.IN_CAPTION;
|
|
431
|
+
return;
|
|
432
|
+
case require_html.TAG_ID.COLGROUP:
|
|
433
|
+
this.insertionMode = InsertionMode.IN_COLUMN_GROUP;
|
|
434
|
+
return;
|
|
435
|
+
case require_html.TAG_ID.TABLE:
|
|
436
|
+
this.insertionMode = InsertionMode.IN_TABLE;
|
|
437
|
+
return;
|
|
438
|
+
case require_html.TAG_ID.BODY:
|
|
439
|
+
this.insertionMode = InsertionMode.IN_BODY;
|
|
440
|
+
return;
|
|
441
|
+
case require_html.TAG_ID.FRAMESET:
|
|
442
|
+
this.insertionMode = InsertionMode.IN_FRAMESET;
|
|
443
|
+
return;
|
|
444
|
+
case require_html.TAG_ID.SELECT:
|
|
445
|
+
this._resetInsertionModeForSelect(i);
|
|
446
|
+
return;
|
|
447
|
+
case require_html.TAG_ID.TEMPLATE:
|
|
448
|
+
this.insertionMode = this.tmplInsertionModeStack[0];
|
|
449
|
+
return;
|
|
450
|
+
case require_html.TAG_ID.HTML:
|
|
451
|
+
this.insertionMode = this.headElement ? InsertionMode.AFTER_HEAD : InsertionMode.BEFORE_HEAD;
|
|
452
|
+
return;
|
|
453
|
+
case require_html.TAG_ID.TD:
|
|
454
|
+
case require_html.TAG_ID.TH:
|
|
455
|
+
if (i > 0) {
|
|
456
|
+
this.insertionMode = InsertionMode.IN_CELL;
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
break;
|
|
460
|
+
case require_html.TAG_ID.HEAD:
|
|
461
|
+
if (i > 0) {
|
|
462
|
+
this.insertionMode = InsertionMode.IN_HEAD;
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
break;
|
|
466
|
+
}
|
|
467
|
+
this.insertionMode = InsertionMode.IN_BODY;
|
|
468
|
+
}
|
|
469
|
+
/** @protected */
|
|
470
|
+
_resetInsertionModeForSelect(selectIdx) {
|
|
471
|
+
if (selectIdx > 0) for (let i = selectIdx - 1; i > 0; i--) {
|
|
472
|
+
const tn = this.openElements.tagIDs[i];
|
|
473
|
+
if (tn === require_html.TAG_ID.TEMPLATE) break;
|
|
474
|
+
else if (tn === require_html.TAG_ID.TABLE) {
|
|
475
|
+
this.insertionMode = InsertionMode.IN_SELECT_IN_TABLE;
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
this.insertionMode = InsertionMode.IN_SELECT;
|
|
480
|
+
}
|
|
481
|
+
/** @protected */
|
|
482
|
+
_isElementCausesFosterParenting(tn) {
|
|
483
|
+
return TABLE_STRUCTURE_TAGS.has(tn);
|
|
484
|
+
}
|
|
485
|
+
/** @protected */
|
|
486
|
+
_shouldFosterParentOnInsertion() {
|
|
487
|
+
return this.fosterParentingEnabled && this.openElements.currentTagId !== void 0 && this._isElementCausesFosterParenting(this.openElements.currentTagId);
|
|
488
|
+
}
|
|
489
|
+
/** @protected */
|
|
490
|
+
_findFosterParentingLocation() {
|
|
491
|
+
for (let i = this.openElements.stackTop; i >= 0; i--) {
|
|
492
|
+
const openElement = this.openElements.items[i];
|
|
493
|
+
switch (this.openElements.tagIDs[i]) {
|
|
494
|
+
case require_html.TAG_ID.TEMPLATE:
|
|
495
|
+
if (this.treeAdapter.getNamespaceURI(openElement) === require_html.NS.HTML) return {
|
|
496
|
+
parent: this.treeAdapter.getTemplateContent(openElement),
|
|
497
|
+
beforeElement: null
|
|
498
|
+
};
|
|
499
|
+
break;
|
|
500
|
+
case require_html.TAG_ID.TABLE: {
|
|
501
|
+
const parent = this.treeAdapter.getParentNode(openElement);
|
|
502
|
+
if (parent) return {
|
|
503
|
+
parent,
|
|
504
|
+
beforeElement: openElement
|
|
505
|
+
};
|
|
506
|
+
return {
|
|
507
|
+
parent: this.openElements.items[i - 1],
|
|
508
|
+
beforeElement: null
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
default:
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
return {
|
|
515
|
+
parent: this.openElements.items[0],
|
|
516
|
+
beforeElement: null
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
/** @protected */
|
|
520
|
+
_fosterParentElement(element) {
|
|
521
|
+
const location = this._findFosterParentingLocation();
|
|
522
|
+
if (location.beforeElement) this.treeAdapter.insertBefore(location.parent, element, location.beforeElement);
|
|
523
|
+
else this.treeAdapter.appendChild(location.parent, element);
|
|
524
|
+
}
|
|
525
|
+
/** @protected */
|
|
526
|
+
_isSpecialElement(element, id) {
|
|
527
|
+
return require_html.SPECIAL_ELEMENTS[this.treeAdapter.getNamespaceURI(element)].has(id);
|
|
528
|
+
}
|
|
529
|
+
/** @internal */
|
|
530
|
+
onCharacter(token) {
|
|
531
|
+
this.skipNextNewLine = false;
|
|
532
|
+
if (this.tokenizer.inForeignNode) {
|
|
533
|
+
characterInForeignContent(this, token);
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
switch (this.insertionMode) {
|
|
537
|
+
case InsertionMode.INITIAL:
|
|
538
|
+
tokenInInitialMode(this, token);
|
|
539
|
+
break;
|
|
540
|
+
case InsertionMode.BEFORE_HTML:
|
|
541
|
+
tokenBeforeHtml(this, token);
|
|
542
|
+
break;
|
|
543
|
+
case InsertionMode.BEFORE_HEAD:
|
|
544
|
+
tokenBeforeHead(this, token);
|
|
545
|
+
break;
|
|
546
|
+
case InsertionMode.IN_HEAD:
|
|
547
|
+
tokenInHead(this, token);
|
|
548
|
+
break;
|
|
549
|
+
case InsertionMode.IN_HEAD_NO_SCRIPT:
|
|
550
|
+
tokenInHeadNoScript(this, token);
|
|
551
|
+
break;
|
|
552
|
+
case InsertionMode.AFTER_HEAD:
|
|
553
|
+
tokenAfterHead(this, token);
|
|
554
|
+
break;
|
|
555
|
+
case InsertionMode.IN_BODY:
|
|
556
|
+
case InsertionMode.IN_CAPTION:
|
|
557
|
+
case InsertionMode.IN_CELL:
|
|
558
|
+
case InsertionMode.IN_TEMPLATE:
|
|
559
|
+
characterInBody(this, token);
|
|
560
|
+
break;
|
|
561
|
+
case InsertionMode.TEXT:
|
|
562
|
+
case InsertionMode.IN_SELECT:
|
|
563
|
+
case InsertionMode.IN_SELECT_IN_TABLE:
|
|
564
|
+
this._insertCharacters(token);
|
|
565
|
+
break;
|
|
566
|
+
case InsertionMode.IN_TABLE:
|
|
567
|
+
case InsertionMode.IN_TABLE_BODY:
|
|
568
|
+
case InsertionMode.IN_ROW:
|
|
569
|
+
characterInTable(this, token);
|
|
570
|
+
break;
|
|
571
|
+
case InsertionMode.IN_TABLE_TEXT:
|
|
572
|
+
characterInTableText(this, token);
|
|
573
|
+
break;
|
|
574
|
+
case InsertionMode.IN_COLUMN_GROUP:
|
|
575
|
+
tokenInColumnGroup(this, token);
|
|
576
|
+
break;
|
|
577
|
+
case InsertionMode.AFTER_BODY:
|
|
578
|
+
tokenAfterBody(this, token);
|
|
579
|
+
break;
|
|
580
|
+
case InsertionMode.AFTER_AFTER_BODY:
|
|
581
|
+
tokenAfterAfterBody(this, token);
|
|
582
|
+
break;
|
|
583
|
+
default:
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
/** @internal */
|
|
587
|
+
onNullCharacter(token) {
|
|
588
|
+
this.skipNextNewLine = false;
|
|
589
|
+
if (this.tokenizer.inForeignNode) {
|
|
590
|
+
nullCharacterInForeignContent(this, token);
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
593
|
+
switch (this.insertionMode) {
|
|
594
|
+
case InsertionMode.INITIAL:
|
|
595
|
+
tokenInInitialMode(this, token);
|
|
596
|
+
break;
|
|
597
|
+
case InsertionMode.BEFORE_HTML:
|
|
598
|
+
tokenBeforeHtml(this, token);
|
|
599
|
+
break;
|
|
600
|
+
case InsertionMode.BEFORE_HEAD:
|
|
601
|
+
tokenBeforeHead(this, token);
|
|
602
|
+
break;
|
|
603
|
+
case InsertionMode.IN_HEAD:
|
|
604
|
+
tokenInHead(this, token);
|
|
605
|
+
break;
|
|
606
|
+
case InsertionMode.IN_HEAD_NO_SCRIPT:
|
|
607
|
+
tokenInHeadNoScript(this, token);
|
|
608
|
+
break;
|
|
609
|
+
case InsertionMode.AFTER_HEAD:
|
|
610
|
+
tokenAfterHead(this, token);
|
|
611
|
+
break;
|
|
612
|
+
case InsertionMode.TEXT:
|
|
613
|
+
this._insertCharacters(token);
|
|
614
|
+
break;
|
|
615
|
+
case InsertionMode.IN_TABLE:
|
|
616
|
+
case InsertionMode.IN_TABLE_BODY:
|
|
617
|
+
case InsertionMode.IN_ROW:
|
|
618
|
+
characterInTable(this, token);
|
|
619
|
+
break;
|
|
620
|
+
case InsertionMode.IN_COLUMN_GROUP:
|
|
621
|
+
tokenInColumnGroup(this, token);
|
|
622
|
+
break;
|
|
623
|
+
case InsertionMode.AFTER_BODY:
|
|
624
|
+
tokenAfterBody(this, token);
|
|
625
|
+
break;
|
|
626
|
+
case InsertionMode.AFTER_AFTER_BODY:
|
|
627
|
+
tokenAfterAfterBody(this, token);
|
|
628
|
+
break;
|
|
629
|
+
default:
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
/** @internal */
|
|
633
|
+
onComment(token) {
|
|
634
|
+
this.skipNextNewLine = false;
|
|
635
|
+
if (this.currentNotInHTML) {
|
|
636
|
+
appendComment(this, token);
|
|
637
|
+
return;
|
|
638
|
+
}
|
|
639
|
+
switch (this.insertionMode) {
|
|
640
|
+
case InsertionMode.INITIAL:
|
|
641
|
+
case InsertionMode.BEFORE_HTML:
|
|
642
|
+
case InsertionMode.BEFORE_HEAD:
|
|
643
|
+
case InsertionMode.IN_HEAD:
|
|
644
|
+
case InsertionMode.IN_HEAD_NO_SCRIPT:
|
|
645
|
+
case InsertionMode.AFTER_HEAD:
|
|
646
|
+
case InsertionMode.IN_BODY:
|
|
647
|
+
case InsertionMode.IN_TABLE:
|
|
648
|
+
case InsertionMode.IN_CAPTION:
|
|
649
|
+
case InsertionMode.IN_COLUMN_GROUP:
|
|
650
|
+
case InsertionMode.IN_TABLE_BODY:
|
|
651
|
+
case InsertionMode.IN_ROW:
|
|
652
|
+
case InsertionMode.IN_CELL:
|
|
653
|
+
case InsertionMode.IN_SELECT:
|
|
654
|
+
case InsertionMode.IN_SELECT_IN_TABLE:
|
|
655
|
+
case InsertionMode.IN_TEMPLATE:
|
|
656
|
+
case InsertionMode.IN_FRAMESET:
|
|
657
|
+
case InsertionMode.AFTER_FRAMESET:
|
|
658
|
+
appendComment(this, token);
|
|
659
|
+
break;
|
|
660
|
+
case InsertionMode.IN_TABLE_TEXT:
|
|
661
|
+
tokenInTableText(this, token);
|
|
662
|
+
break;
|
|
663
|
+
case InsertionMode.AFTER_BODY:
|
|
664
|
+
appendCommentToRootHtmlElement(this, token);
|
|
665
|
+
break;
|
|
666
|
+
case InsertionMode.AFTER_AFTER_BODY:
|
|
667
|
+
case InsertionMode.AFTER_AFTER_FRAMESET:
|
|
668
|
+
appendCommentToDocument(this, token);
|
|
669
|
+
break;
|
|
670
|
+
default:
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
/** @internal */
|
|
674
|
+
onDoctype(token) {
|
|
675
|
+
this.skipNextNewLine = false;
|
|
676
|
+
switch (this.insertionMode) {
|
|
677
|
+
case InsertionMode.INITIAL:
|
|
678
|
+
doctypeInInitialMode(this, token);
|
|
679
|
+
break;
|
|
680
|
+
case InsertionMode.BEFORE_HEAD:
|
|
681
|
+
case InsertionMode.IN_HEAD:
|
|
682
|
+
case InsertionMode.IN_HEAD_NO_SCRIPT:
|
|
683
|
+
case InsertionMode.AFTER_HEAD:
|
|
684
|
+
this._err(token, require_error_codes.ERR.misplacedDoctype);
|
|
685
|
+
break;
|
|
686
|
+
case InsertionMode.IN_TABLE_TEXT:
|
|
687
|
+
tokenInTableText(this, token);
|
|
688
|
+
break;
|
|
689
|
+
default:
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
/** @internal */
|
|
693
|
+
onStartTag(token) {
|
|
694
|
+
this.skipNextNewLine = false;
|
|
695
|
+
this.currentToken = token;
|
|
696
|
+
this._processStartTag(token);
|
|
697
|
+
if (token.selfClosing && !token.ackSelfClosing) this._err(token, require_error_codes.ERR.nonVoidHtmlElementStartTagWithTrailingSolidus);
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* Processes a given start tag.
|
|
701
|
+
*
|
|
702
|
+
* `onStartTag` checks if a self-closing tag was recognized. When a token
|
|
703
|
+
* is moved inbetween multiple insertion modes, this check for self-closing
|
|
704
|
+
* could lead to false positives. To avoid this, `_processStartTag` is used
|
|
705
|
+
* for nested calls.
|
|
706
|
+
*
|
|
707
|
+
* @param token The token to process.
|
|
708
|
+
* @protected
|
|
709
|
+
*/
|
|
710
|
+
_processStartTag(token) {
|
|
711
|
+
if (this.shouldProcessStartTagTokenInForeignContent(token)) startTagInForeignContent(this, token);
|
|
712
|
+
else this._startTagOutsideForeignContent(token);
|
|
713
|
+
}
|
|
714
|
+
/** @protected */
|
|
715
|
+
_startTagOutsideForeignContent(token) {
|
|
716
|
+
switch (this.insertionMode) {
|
|
717
|
+
case InsertionMode.INITIAL:
|
|
718
|
+
tokenInInitialMode(this, token);
|
|
719
|
+
break;
|
|
720
|
+
case InsertionMode.BEFORE_HTML:
|
|
721
|
+
startTagBeforeHtml(this, token);
|
|
722
|
+
break;
|
|
723
|
+
case InsertionMode.BEFORE_HEAD:
|
|
724
|
+
startTagBeforeHead(this, token);
|
|
725
|
+
break;
|
|
726
|
+
case InsertionMode.IN_HEAD:
|
|
727
|
+
startTagInHead(this, token);
|
|
728
|
+
break;
|
|
729
|
+
case InsertionMode.IN_HEAD_NO_SCRIPT:
|
|
730
|
+
startTagInHeadNoScript(this, token);
|
|
731
|
+
break;
|
|
732
|
+
case InsertionMode.AFTER_HEAD:
|
|
733
|
+
startTagAfterHead(this, token);
|
|
734
|
+
break;
|
|
735
|
+
case InsertionMode.IN_BODY:
|
|
736
|
+
startTagInBody(this, token);
|
|
737
|
+
break;
|
|
738
|
+
case InsertionMode.IN_TABLE:
|
|
739
|
+
startTagInTable(this, token);
|
|
740
|
+
break;
|
|
741
|
+
case InsertionMode.IN_TABLE_TEXT:
|
|
742
|
+
tokenInTableText(this, token);
|
|
743
|
+
break;
|
|
744
|
+
case InsertionMode.IN_CAPTION:
|
|
745
|
+
startTagInCaption(this, token);
|
|
746
|
+
break;
|
|
747
|
+
case InsertionMode.IN_COLUMN_GROUP:
|
|
748
|
+
startTagInColumnGroup(this, token);
|
|
749
|
+
break;
|
|
750
|
+
case InsertionMode.IN_TABLE_BODY:
|
|
751
|
+
startTagInTableBody(this, token);
|
|
752
|
+
break;
|
|
753
|
+
case InsertionMode.IN_ROW:
|
|
754
|
+
startTagInRow(this, token);
|
|
755
|
+
break;
|
|
756
|
+
case InsertionMode.IN_CELL:
|
|
757
|
+
startTagInCell(this, token);
|
|
758
|
+
break;
|
|
759
|
+
case InsertionMode.IN_SELECT:
|
|
760
|
+
startTagInSelect(this, token);
|
|
761
|
+
break;
|
|
762
|
+
case InsertionMode.IN_SELECT_IN_TABLE:
|
|
763
|
+
startTagInSelectInTable(this, token);
|
|
764
|
+
break;
|
|
765
|
+
case InsertionMode.IN_TEMPLATE:
|
|
766
|
+
startTagInTemplate(this, token);
|
|
767
|
+
break;
|
|
768
|
+
case InsertionMode.AFTER_BODY:
|
|
769
|
+
startTagAfterBody(this, token);
|
|
770
|
+
break;
|
|
771
|
+
case InsertionMode.IN_FRAMESET:
|
|
772
|
+
startTagInFrameset(this, token);
|
|
773
|
+
break;
|
|
774
|
+
case InsertionMode.AFTER_FRAMESET:
|
|
775
|
+
startTagAfterFrameset(this, token);
|
|
776
|
+
break;
|
|
777
|
+
case InsertionMode.AFTER_AFTER_BODY:
|
|
778
|
+
startTagAfterAfterBody(this, token);
|
|
779
|
+
break;
|
|
780
|
+
case InsertionMode.AFTER_AFTER_FRAMESET:
|
|
781
|
+
startTagAfterAfterFrameset(this, token);
|
|
782
|
+
break;
|
|
783
|
+
default:
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
/** @internal */
|
|
787
|
+
onEndTag(token) {
|
|
788
|
+
this.skipNextNewLine = false;
|
|
789
|
+
this.currentToken = token;
|
|
790
|
+
if (this.currentNotInHTML) endTagInForeignContent(this, token);
|
|
791
|
+
else this._endTagOutsideForeignContent(token);
|
|
792
|
+
}
|
|
793
|
+
/** @protected */
|
|
794
|
+
_endTagOutsideForeignContent(token) {
|
|
795
|
+
switch (this.insertionMode) {
|
|
796
|
+
case InsertionMode.INITIAL:
|
|
797
|
+
tokenInInitialMode(this, token);
|
|
798
|
+
break;
|
|
799
|
+
case InsertionMode.BEFORE_HTML:
|
|
800
|
+
endTagBeforeHtml(this, token);
|
|
801
|
+
break;
|
|
802
|
+
case InsertionMode.BEFORE_HEAD:
|
|
803
|
+
endTagBeforeHead(this, token);
|
|
804
|
+
break;
|
|
805
|
+
case InsertionMode.IN_HEAD:
|
|
806
|
+
endTagInHead(this, token);
|
|
807
|
+
break;
|
|
808
|
+
case InsertionMode.IN_HEAD_NO_SCRIPT:
|
|
809
|
+
endTagInHeadNoScript(this, token);
|
|
810
|
+
break;
|
|
811
|
+
case InsertionMode.AFTER_HEAD:
|
|
812
|
+
endTagAfterHead(this, token);
|
|
813
|
+
break;
|
|
814
|
+
case InsertionMode.IN_BODY:
|
|
815
|
+
endTagInBody(this, token);
|
|
816
|
+
break;
|
|
817
|
+
case InsertionMode.TEXT:
|
|
818
|
+
endTagInText(this, token);
|
|
819
|
+
break;
|
|
820
|
+
case InsertionMode.IN_TABLE:
|
|
821
|
+
endTagInTable(this, token);
|
|
822
|
+
break;
|
|
823
|
+
case InsertionMode.IN_TABLE_TEXT:
|
|
824
|
+
tokenInTableText(this, token);
|
|
825
|
+
break;
|
|
826
|
+
case InsertionMode.IN_CAPTION:
|
|
827
|
+
endTagInCaption(this, token);
|
|
828
|
+
break;
|
|
829
|
+
case InsertionMode.IN_COLUMN_GROUP:
|
|
830
|
+
endTagInColumnGroup(this, token);
|
|
831
|
+
break;
|
|
832
|
+
case InsertionMode.IN_TABLE_BODY:
|
|
833
|
+
endTagInTableBody(this, token);
|
|
834
|
+
break;
|
|
835
|
+
case InsertionMode.IN_ROW:
|
|
836
|
+
endTagInRow(this, token);
|
|
837
|
+
break;
|
|
838
|
+
case InsertionMode.IN_CELL:
|
|
839
|
+
endTagInCell(this, token);
|
|
840
|
+
break;
|
|
841
|
+
case InsertionMode.IN_SELECT:
|
|
842
|
+
endTagInSelect(this, token);
|
|
843
|
+
break;
|
|
844
|
+
case InsertionMode.IN_SELECT_IN_TABLE:
|
|
845
|
+
endTagInSelectInTable(this, token);
|
|
846
|
+
break;
|
|
847
|
+
case InsertionMode.IN_TEMPLATE:
|
|
848
|
+
endTagInTemplate(this, token);
|
|
849
|
+
break;
|
|
850
|
+
case InsertionMode.AFTER_BODY:
|
|
851
|
+
endTagAfterBody(this, token);
|
|
852
|
+
break;
|
|
853
|
+
case InsertionMode.IN_FRAMESET:
|
|
854
|
+
endTagInFrameset(this, token);
|
|
855
|
+
break;
|
|
856
|
+
case InsertionMode.AFTER_FRAMESET:
|
|
857
|
+
endTagAfterFrameset(this, token);
|
|
858
|
+
break;
|
|
859
|
+
case InsertionMode.AFTER_AFTER_BODY:
|
|
860
|
+
tokenAfterAfterBody(this, token);
|
|
861
|
+
break;
|
|
862
|
+
default:
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
/** @internal */
|
|
866
|
+
onEof(token) {
|
|
867
|
+
switch (this.insertionMode) {
|
|
868
|
+
case InsertionMode.INITIAL:
|
|
869
|
+
tokenInInitialMode(this, token);
|
|
870
|
+
break;
|
|
871
|
+
case InsertionMode.BEFORE_HTML:
|
|
872
|
+
tokenBeforeHtml(this, token);
|
|
873
|
+
break;
|
|
874
|
+
case InsertionMode.BEFORE_HEAD:
|
|
875
|
+
tokenBeforeHead(this, token);
|
|
876
|
+
break;
|
|
877
|
+
case InsertionMode.IN_HEAD:
|
|
878
|
+
tokenInHead(this, token);
|
|
879
|
+
break;
|
|
880
|
+
case InsertionMode.IN_HEAD_NO_SCRIPT:
|
|
881
|
+
tokenInHeadNoScript(this, token);
|
|
882
|
+
break;
|
|
883
|
+
case InsertionMode.AFTER_HEAD:
|
|
884
|
+
tokenAfterHead(this, token);
|
|
885
|
+
break;
|
|
886
|
+
case InsertionMode.IN_BODY:
|
|
887
|
+
case InsertionMode.IN_TABLE:
|
|
888
|
+
case InsertionMode.IN_CAPTION:
|
|
889
|
+
case InsertionMode.IN_COLUMN_GROUP:
|
|
890
|
+
case InsertionMode.IN_TABLE_BODY:
|
|
891
|
+
case InsertionMode.IN_ROW:
|
|
892
|
+
case InsertionMode.IN_CELL:
|
|
893
|
+
case InsertionMode.IN_SELECT:
|
|
894
|
+
case InsertionMode.IN_SELECT_IN_TABLE:
|
|
895
|
+
eofInBody(this, token);
|
|
896
|
+
break;
|
|
897
|
+
case InsertionMode.TEXT:
|
|
898
|
+
eofInText(this, token);
|
|
899
|
+
break;
|
|
900
|
+
case InsertionMode.IN_TABLE_TEXT:
|
|
901
|
+
tokenInTableText(this, token);
|
|
902
|
+
break;
|
|
903
|
+
case InsertionMode.IN_TEMPLATE:
|
|
904
|
+
eofInTemplate(this, token);
|
|
905
|
+
break;
|
|
906
|
+
case InsertionMode.AFTER_BODY:
|
|
907
|
+
case InsertionMode.IN_FRAMESET:
|
|
908
|
+
case InsertionMode.AFTER_FRAMESET:
|
|
909
|
+
case InsertionMode.AFTER_AFTER_BODY:
|
|
910
|
+
case InsertionMode.AFTER_AFTER_FRAMESET:
|
|
911
|
+
stopParsing(this, token);
|
|
912
|
+
break;
|
|
913
|
+
default:
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
/** @internal */
|
|
917
|
+
onWhitespaceCharacter(token) {
|
|
918
|
+
if (this.skipNextNewLine) {
|
|
919
|
+
this.skipNextNewLine = false;
|
|
920
|
+
if (token.chars.charCodeAt(0) === require_unicode.CODE_POINTS.LINE_FEED) {
|
|
921
|
+
if (token.chars.length === 1) return;
|
|
922
|
+
token.chars = token.chars.substr(1);
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
if (this.tokenizer.inForeignNode) {
|
|
926
|
+
this._insertCharacters(token);
|
|
927
|
+
return;
|
|
928
|
+
}
|
|
929
|
+
switch (this.insertionMode) {
|
|
930
|
+
case InsertionMode.IN_HEAD:
|
|
931
|
+
case InsertionMode.IN_HEAD_NO_SCRIPT:
|
|
932
|
+
case InsertionMode.AFTER_HEAD:
|
|
933
|
+
case InsertionMode.TEXT:
|
|
934
|
+
case InsertionMode.IN_COLUMN_GROUP:
|
|
935
|
+
case InsertionMode.IN_SELECT:
|
|
936
|
+
case InsertionMode.IN_SELECT_IN_TABLE:
|
|
937
|
+
case InsertionMode.IN_FRAMESET:
|
|
938
|
+
case InsertionMode.AFTER_FRAMESET:
|
|
939
|
+
this._insertCharacters(token);
|
|
940
|
+
break;
|
|
941
|
+
case InsertionMode.IN_BODY:
|
|
942
|
+
case InsertionMode.IN_CAPTION:
|
|
943
|
+
case InsertionMode.IN_CELL:
|
|
944
|
+
case InsertionMode.IN_TEMPLATE:
|
|
945
|
+
case InsertionMode.AFTER_BODY:
|
|
946
|
+
case InsertionMode.AFTER_AFTER_BODY:
|
|
947
|
+
case InsertionMode.AFTER_AFTER_FRAMESET:
|
|
948
|
+
whitespaceCharacterInBody(this, token);
|
|
949
|
+
break;
|
|
950
|
+
case InsertionMode.IN_TABLE:
|
|
951
|
+
case InsertionMode.IN_TABLE_BODY:
|
|
952
|
+
case InsertionMode.IN_ROW:
|
|
953
|
+
characterInTable(this, token);
|
|
954
|
+
break;
|
|
955
|
+
case InsertionMode.IN_TABLE_TEXT:
|
|
956
|
+
whitespaceCharacterInTableText(this, token);
|
|
957
|
+
break;
|
|
958
|
+
default:
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
};
|
|
962
|
+
function aaObtainFormattingElementEntry(p, token) {
|
|
963
|
+
let formattingElementEntry = p.activeFormattingElements.getElementEntryInScopeWithTagName(token.tagName);
|
|
964
|
+
if (formattingElementEntry) {
|
|
965
|
+
if (!p.openElements.contains(formattingElementEntry.element)) {
|
|
966
|
+
p.activeFormattingElements.removeEntry(formattingElementEntry);
|
|
967
|
+
formattingElementEntry = null;
|
|
968
|
+
} else if (!p.openElements.hasInScope(token.tagID)) formattingElementEntry = null;
|
|
969
|
+
} else genericEndTagInBody(p, token);
|
|
970
|
+
return formattingElementEntry;
|
|
971
|
+
}
|
|
972
|
+
function aaObtainFurthestBlock(p, formattingElementEntry) {
|
|
973
|
+
let furthestBlock = null;
|
|
974
|
+
let idx = p.openElements.stackTop;
|
|
975
|
+
for (; idx >= 0; idx--) {
|
|
976
|
+
const element = p.openElements.items[idx];
|
|
977
|
+
if (element === formattingElementEntry.element) break;
|
|
978
|
+
if (p._isSpecialElement(element, p.openElements.tagIDs[idx])) furthestBlock = element;
|
|
979
|
+
}
|
|
980
|
+
if (!furthestBlock) {
|
|
981
|
+
p.openElements.shortenToLength(Math.max(idx, 0));
|
|
982
|
+
p.activeFormattingElements.removeEntry(formattingElementEntry);
|
|
983
|
+
}
|
|
984
|
+
return furthestBlock;
|
|
985
|
+
}
|
|
986
|
+
function aaInnerLoop(p, furthestBlock, formattingElement) {
|
|
987
|
+
let lastElement = furthestBlock;
|
|
988
|
+
let nextElement = p.openElements.getCommonAncestor(furthestBlock);
|
|
989
|
+
for (let i = 0, element = nextElement; element !== formattingElement; i++, element = nextElement) {
|
|
990
|
+
nextElement = p.openElements.getCommonAncestor(element);
|
|
991
|
+
const elementEntry = p.activeFormattingElements.getElementEntry(element);
|
|
992
|
+
const counterOverflow = elementEntry && i >= AA_INNER_LOOP_ITER;
|
|
993
|
+
if (!elementEntry || counterOverflow) {
|
|
994
|
+
if (counterOverflow) p.activeFormattingElements.removeEntry(elementEntry);
|
|
995
|
+
p.openElements.remove(element);
|
|
996
|
+
} else {
|
|
997
|
+
element = aaRecreateElementFromEntry(p, elementEntry);
|
|
998
|
+
if (lastElement === furthestBlock) p.activeFormattingElements.bookmark = elementEntry;
|
|
999
|
+
p.treeAdapter.detachNode(lastElement);
|
|
1000
|
+
p.treeAdapter.appendChild(element, lastElement);
|
|
1001
|
+
lastElement = element;
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
return lastElement;
|
|
1005
|
+
}
|
|
1006
|
+
function aaRecreateElementFromEntry(p, elementEntry) {
|
|
1007
|
+
const ns = p.treeAdapter.getNamespaceURI(elementEntry.element);
|
|
1008
|
+
const newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);
|
|
1009
|
+
p.openElements.replace(elementEntry.element, newElement);
|
|
1010
|
+
elementEntry.element = newElement;
|
|
1011
|
+
return newElement;
|
|
1012
|
+
}
|
|
1013
|
+
function aaInsertLastNodeInCommonAncestor(p, commonAncestor, lastElement) {
|
|
1014
|
+
const tid = require_html.getTagID(p.treeAdapter.getTagName(commonAncestor));
|
|
1015
|
+
if (p._isElementCausesFosterParenting(tid)) p._fosterParentElement(lastElement);
|
|
1016
|
+
else {
|
|
1017
|
+
const ns = p.treeAdapter.getNamespaceURI(commonAncestor);
|
|
1018
|
+
if (tid === require_html.TAG_ID.TEMPLATE && ns === require_html.NS.HTML) commonAncestor = p.treeAdapter.getTemplateContent(commonAncestor);
|
|
1019
|
+
p.treeAdapter.appendChild(commonAncestor, lastElement);
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
function aaReplaceFormattingElement(p, furthestBlock, formattingElementEntry) {
|
|
1023
|
+
const ns = p.treeAdapter.getNamespaceURI(formattingElementEntry.element);
|
|
1024
|
+
const { token } = formattingElementEntry;
|
|
1025
|
+
const newElement = p.treeAdapter.createElement(token.tagName, ns, token.attrs);
|
|
1026
|
+
p._adoptNodes(furthestBlock, newElement);
|
|
1027
|
+
p.treeAdapter.appendChild(furthestBlock, newElement);
|
|
1028
|
+
p.activeFormattingElements.insertElementAfterBookmark(newElement, token);
|
|
1029
|
+
p.activeFormattingElements.removeEntry(formattingElementEntry);
|
|
1030
|
+
p.openElements.remove(formattingElementEntry.element);
|
|
1031
|
+
p.openElements.insertAfter(furthestBlock, newElement, token.tagID);
|
|
1032
|
+
}
|
|
1033
|
+
function callAdoptionAgency(p, token) {
|
|
1034
|
+
for (let i = 0; i < AA_OUTER_LOOP_ITER; i++) {
|
|
1035
|
+
const formattingElementEntry = aaObtainFormattingElementEntry(p, token);
|
|
1036
|
+
if (!formattingElementEntry) break;
|
|
1037
|
+
const furthestBlock = aaObtainFurthestBlock(p, formattingElementEntry);
|
|
1038
|
+
if (!furthestBlock) break;
|
|
1039
|
+
p.activeFormattingElements.bookmark = formattingElementEntry;
|
|
1040
|
+
const lastElement = aaInnerLoop(p, furthestBlock, formattingElementEntry.element);
|
|
1041
|
+
const commonAncestor = p.openElements.getCommonAncestor(formattingElementEntry.element);
|
|
1042
|
+
p.treeAdapter.detachNode(lastElement);
|
|
1043
|
+
if (commonAncestor) aaInsertLastNodeInCommonAncestor(p, commonAncestor, lastElement);
|
|
1044
|
+
aaReplaceFormattingElement(p, furthestBlock, formattingElementEntry);
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
function appendComment(p, token) {
|
|
1048
|
+
p._appendCommentNode(token, p.openElements.currentTmplContentOrNode);
|
|
1049
|
+
}
|
|
1050
|
+
function appendCommentToRootHtmlElement(p, token) {
|
|
1051
|
+
p._appendCommentNode(token, p.openElements.items[0]);
|
|
1052
|
+
}
|
|
1053
|
+
function appendCommentToDocument(p, token) {
|
|
1054
|
+
p._appendCommentNode(token, p.document);
|
|
1055
|
+
}
|
|
1056
|
+
function stopParsing(p, token) {
|
|
1057
|
+
p.stopped = true;
|
|
1058
|
+
if (token.location) {
|
|
1059
|
+
const target = p.fragmentContext ? 0 : 2;
|
|
1060
|
+
for (let i = p.openElements.stackTop; i >= target; i--) p._setEndLocation(p.openElements.items[i], token);
|
|
1061
|
+
if (!p.fragmentContext && p.openElements.stackTop >= 0) {
|
|
1062
|
+
const htmlElement = p.openElements.items[0];
|
|
1063
|
+
const htmlLocation = p.treeAdapter.getNodeSourceCodeLocation(htmlElement);
|
|
1064
|
+
if (htmlLocation && !htmlLocation.endTag) {
|
|
1065
|
+
p._setEndLocation(htmlElement, token);
|
|
1066
|
+
if (p.openElements.stackTop >= 1) {
|
|
1067
|
+
const bodyElement = p.openElements.items[1];
|
|
1068
|
+
const bodyLocation = p.treeAdapter.getNodeSourceCodeLocation(bodyElement);
|
|
1069
|
+
if (bodyLocation && !bodyLocation.endTag) p._setEndLocation(bodyElement, token);
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
function doctypeInInitialMode(p, token) {
|
|
1076
|
+
p._setDocumentType(token);
|
|
1077
|
+
const mode = token.forceQuirks ? require_html.DOCUMENT_MODE.QUIRKS : require_doctype.getDocumentMode(token);
|
|
1078
|
+
if (!require_doctype.isConforming(token)) p._err(token, require_error_codes.ERR.nonConformingDoctype);
|
|
1079
|
+
p.treeAdapter.setDocumentMode(p.document, mode);
|
|
1080
|
+
p.insertionMode = InsertionMode.BEFORE_HTML;
|
|
1081
|
+
}
|
|
1082
|
+
function tokenInInitialMode(p, token) {
|
|
1083
|
+
p._err(token, require_error_codes.ERR.missingDoctype, true);
|
|
1084
|
+
p.treeAdapter.setDocumentMode(p.document, require_html.DOCUMENT_MODE.QUIRKS);
|
|
1085
|
+
p.insertionMode = InsertionMode.BEFORE_HTML;
|
|
1086
|
+
p._processToken(token);
|
|
1087
|
+
}
|
|
1088
|
+
function startTagBeforeHtml(p, token) {
|
|
1089
|
+
if (token.tagID === require_html.TAG_ID.HTML) {
|
|
1090
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1091
|
+
p.insertionMode = InsertionMode.BEFORE_HEAD;
|
|
1092
|
+
} else tokenBeforeHtml(p, token);
|
|
1093
|
+
}
|
|
1094
|
+
function endTagBeforeHtml(p, token) {
|
|
1095
|
+
const tn = token.tagID;
|
|
1096
|
+
if (tn === require_html.TAG_ID.HTML || tn === require_html.TAG_ID.HEAD || tn === require_html.TAG_ID.BODY || tn === require_html.TAG_ID.BR) tokenBeforeHtml(p, token);
|
|
1097
|
+
}
|
|
1098
|
+
function tokenBeforeHtml(p, token) {
|
|
1099
|
+
p._insertFakeRootElement();
|
|
1100
|
+
p.insertionMode = InsertionMode.BEFORE_HEAD;
|
|
1101
|
+
p._processToken(token);
|
|
1102
|
+
}
|
|
1103
|
+
function startTagBeforeHead(p, token) {
|
|
1104
|
+
switch (token.tagID) {
|
|
1105
|
+
case require_html.TAG_ID.HTML:
|
|
1106
|
+
startTagInBody(p, token);
|
|
1107
|
+
break;
|
|
1108
|
+
case require_html.TAG_ID.HEAD:
|
|
1109
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1110
|
+
p.headElement = p.openElements.current;
|
|
1111
|
+
p.insertionMode = InsertionMode.IN_HEAD;
|
|
1112
|
+
break;
|
|
1113
|
+
default: tokenBeforeHead(p, token);
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
function endTagBeforeHead(p, token) {
|
|
1117
|
+
const tn = token.tagID;
|
|
1118
|
+
if (tn === require_html.TAG_ID.HEAD || tn === require_html.TAG_ID.BODY || tn === require_html.TAG_ID.HTML || tn === require_html.TAG_ID.BR) tokenBeforeHead(p, token);
|
|
1119
|
+
else p._err(token, require_error_codes.ERR.endTagWithoutMatchingOpenElement);
|
|
1120
|
+
}
|
|
1121
|
+
function tokenBeforeHead(p, token) {
|
|
1122
|
+
p._insertFakeElement(require_html.TAG_NAMES.HEAD, require_html.TAG_ID.HEAD);
|
|
1123
|
+
p.headElement = p.openElements.current;
|
|
1124
|
+
p.insertionMode = InsertionMode.IN_HEAD;
|
|
1125
|
+
p._processToken(token);
|
|
1126
|
+
}
|
|
1127
|
+
function startTagInHead(p, token) {
|
|
1128
|
+
switch (token.tagID) {
|
|
1129
|
+
case require_html.TAG_ID.HTML:
|
|
1130
|
+
startTagInBody(p, token);
|
|
1131
|
+
break;
|
|
1132
|
+
case require_html.TAG_ID.BASE:
|
|
1133
|
+
case require_html.TAG_ID.BASEFONT:
|
|
1134
|
+
case require_html.TAG_ID.BGSOUND:
|
|
1135
|
+
case require_html.TAG_ID.LINK:
|
|
1136
|
+
case require_html.TAG_ID.META:
|
|
1137
|
+
p._appendElement(token, require_html.NS.HTML);
|
|
1138
|
+
token.ackSelfClosing = true;
|
|
1139
|
+
break;
|
|
1140
|
+
case require_html.TAG_ID.TITLE:
|
|
1141
|
+
p._switchToTextParsing(token, require_index.TokenizerMode.RCDATA);
|
|
1142
|
+
break;
|
|
1143
|
+
case require_html.TAG_ID.NOSCRIPT:
|
|
1144
|
+
if (p.options.scriptingEnabled) p._switchToTextParsing(token, require_index.TokenizerMode.RAWTEXT);
|
|
1145
|
+
else {
|
|
1146
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1147
|
+
p.insertionMode = InsertionMode.IN_HEAD_NO_SCRIPT;
|
|
1148
|
+
}
|
|
1149
|
+
break;
|
|
1150
|
+
case require_html.TAG_ID.NOFRAMES:
|
|
1151
|
+
case require_html.TAG_ID.STYLE:
|
|
1152
|
+
p._switchToTextParsing(token, require_index.TokenizerMode.RAWTEXT);
|
|
1153
|
+
break;
|
|
1154
|
+
case require_html.TAG_ID.SCRIPT:
|
|
1155
|
+
p._switchToTextParsing(token, require_index.TokenizerMode.SCRIPT_DATA);
|
|
1156
|
+
break;
|
|
1157
|
+
case require_html.TAG_ID.TEMPLATE:
|
|
1158
|
+
p._insertTemplate(token);
|
|
1159
|
+
p.activeFormattingElements.insertMarker();
|
|
1160
|
+
p.framesetOk = false;
|
|
1161
|
+
p.insertionMode = InsertionMode.IN_TEMPLATE;
|
|
1162
|
+
p.tmplInsertionModeStack.unshift(InsertionMode.IN_TEMPLATE);
|
|
1163
|
+
break;
|
|
1164
|
+
case require_html.TAG_ID.HEAD:
|
|
1165
|
+
p._err(token, require_error_codes.ERR.misplacedStartTagForHeadElement);
|
|
1166
|
+
break;
|
|
1167
|
+
default: tokenInHead(p, token);
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
function endTagInHead(p, token) {
|
|
1171
|
+
switch (token.tagID) {
|
|
1172
|
+
case require_html.TAG_ID.HEAD:
|
|
1173
|
+
p.openElements.pop();
|
|
1174
|
+
p.insertionMode = InsertionMode.AFTER_HEAD;
|
|
1175
|
+
break;
|
|
1176
|
+
case require_html.TAG_ID.BODY:
|
|
1177
|
+
case require_html.TAG_ID.BR:
|
|
1178
|
+
case require_html.TAG_ID.HTML:
|
|
1179
|
+
tokenInHead(p, token);
|
|
1180
|
+
break;
|
|
1181
|
+
case require_html.TAG_ID.TEMPLATE:
|
|
1182
|
+
templateEndTagInHead(p, token);
|
|
1183
|
+
break;
|
|
1184
|
+
default: p._err(token, require_error_codes.ERR.endTagWithoutMatchingOpenElement);
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
function templateEndTagInHead(p, token) {
|
|
1188
|
+
if (p.openElements.tmplCount > 0) {
|
|
1189
|
+
p.openElements.generateImpliedEndTagsThoroughly();
|
|
1190
|
+
if (p.openElements.currentTagId !== require_html.TAG_ID.TEMPLATE) p._err(token, require_error_codes.ERR.closingOfElementWithOpenChildElements);
|
|
1191
|
+
p.openElements.popUntilTagNamePopped(require_html.TAG_ID.TEMPLATE);
|
|
1192
|
+
p.activeFormattingElements.clearToLastMarker();
|
|
1193
|
+
p.tmplInsertionModeStack.shift();
|
|
1194
|
+
p._resetInsertionMode();
|
|
1195
|
+
} else p._err(token, require_error_codes.ERR.endTagWithoutMatchingOpenElement);
|
|
1196
|
+
}
|
|
1197
|
+
function tokenInHead(p, token) {
|
|
1198
|
+
p.openElements.pop();
|
|
1199
|
+
p.insertionMode = InsertionMode.AFTER_HEAD;
|
|
1200
|
+
p._processToken(token);
|
|
1201
|
+
}
|
|
1202
|
+
function startTagInHeadNoScript(p, token) {
|
|
1203
|
+
switch (token.tagID) {
|
|
1204
|
+
case require_html.TAG_ID.HTML:
|
|
1205
|
+
startTagInBody(p, token);
|
|
1206
|
+
break;
|
|
1207
|
+
case require_html.TAG_ID.BASEFONT:
|
|
1208
|
+
case require_html.TAG_ID.BGSOUND:
|
|
1209
|
+
case require_html.TAG_ID.HEAD:
|
|
1210
|
+
case require_html.TAG_ID.LINK:
|
|
1211
|
+
case require_html.TAG_ID.META:
|
|
1212
|
+
case require_html.TAG_ID.NOFRAMES:
|
|
1213
|
+
case require_html.TAG_ID.STYLE:
|
|
1214
|
+
startTagInHead(p, token);
|
|
1215
|
+
break;
|
|
1216
|
+
case require_html.TAG_ID.NOSCRIPT:
|
|
1217
|
+
p._err(token, require_error_codes.ERR.nestedNoscriptInHead);
|
|
1218
|
+
break;
|
|
1219
|
+
default: tokenInHeadNoScript(p, token);
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
function endTagInHeadNoScript(p, token) {
|
|
1223
|
+
switch (token.tagID) {
|
|
1224
|
+
case require_html.TAG_ID.NOSCRIPT:
|
|
1225
|
+
p.openElements.pop();
|
|
1226
|
+
p.insertionMode = InsertionMode.IN_HEAD;
|
|
1227
|
+
break;
|
|
1228
|
+
case require_html.TAG_ID.BR:
|
|
1229
|
+
tokenInHeadNoScript(p, token);
|
|
1230
|
+
break;
|
|
1231
|
+
default: p._err(token, require_error_codes.ERR.endTagWithoutMatchingOpenElement);
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
function tokenInHeadNoScript(p, token) {
|
|
1235
|
+
const errCode = token.type === require_token.TokenType.EOF ? require_error_codes.ERR.openElementsLeftAfterEof : require_error_codes.ERR.disallowedContentInNoscriptInHead;
|
|
1236
|
+
p._err(token, errCode);
|
|
1237
|
+
p.openElements.pop();
|
|
1238
|
+
p.insertionMode = InsertionMode.IN_HEAD;
|
|
1239
|
+
p._processToken(token);
|
|
1240
|
+
}
|
|
1241
|
+
function startTagAfterHead(p, token) {
|
|
1242
|
+
switch (token.tagID) {
|
|
1243
|
+
case require_html.TAG_ID.HTML:
|
|
1244
|
+
startTagInBody(p, token);
|
|
1245
|
+
break;
|
|
1246
|
+
case require_html.TAG_ID.BODY:
|
|
1247
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1248
|
+
p.framesetOk = false;
|
|
1249
|
+
p.insertionMode = InsertionMode.IN_BODY;
|
|
1250
|
+
break;
|
|
1251
|
+
case require_html.TAG_ID.FRAMESET:
|
|
1252
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1253
|
+
p.insertionMode = InsertionMode.IN_FRAMESET;
|
|
1254
|
+
break;
|
|
1255
|
+
case require_html.TAG_ID.BASE:
|
|
1256
|
+
case require_html.TAG_ID.BASEFONT:
|
|
1257
|
+
case require_html.TAG_ID.BGSOUND:
|
|
1258
|
+
case require_html.TAG_ID.LINK:
|
|
1259
|
+
case require_html.TAG_ID.META:
|
|
1260
|
+
case require_html.TAG_ID.NOFRAMES:
|
|
1261
|
+
case require_html.TAG_ID.SCRIPT:
|
|
1262
|
+
case require_html.TAG_ID.STYLE:
|
|
1263
|
+
case require_html.TAG_ID.TEMPLATE:
|
|
1264
|
+
case require_html.TAG_ID.TITLE:
|
|
1265
|
+
p._err(token, require_error_codes.ERR.abandonedHeadElementChild);
|
|
1266
|
+
p.openElements.push(p.headElement, require_html.TAG_ID.HEAD);
|
|
1267
|
+
startTagInHead(p, token);
|
|
1268
|
+
p.openElements.remove(p.headElement);
|
|
1269
|
+
break;
|
|
1270
|
+
case require_html.TAG_ID.HEAD:
|
|
1271
|
+
p._err(token, require_error_codes.ERR.misplacedStartTagForHeadElement);
|
|
1272
|
+
break;
|
|
1273
|
+
default: tokenAfterHead(p, token);
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
function endTagAfterHead(p, token) {
|
|
1277
|
+
switch (token.tagID) {
|
|
1278
|
+
case require_html.TAG_ID.BODY:
|
|
1279
|
+
case require_html.TAG_ID.HTML:
|
|
1280
|
+
case require_html.TAG_ID.BR:
|
|
1281
|
+
tokenAfterHead(p, token);
|
|
1282
|
+
break;
|
|
1283
|
+
case require_html.TAG_ID.TEMPLATE:
|
|
1284
|
+
templateEndTagInHead(p, token);
|
|
1285
|
+
break;
|
|
1286
|
+
default: p._err(token, require_error_codes.ERR.endTagWithoutMatchingOpenElement);
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
function tokenAfterHead(p, token) {
|
|
1290
|
+
p._insertFakeElement(require_html.TAG_NAMES.BODY, require_html.TAG_ID.BODY);
|
|
1291
|
+
p.insertionMode = InsertionMode.IN_BODY;
|
|
1292
|
+
modeInBody(p, token);
|
|
1293
|
+
}
|
|
1294
|
+
function modeInBody(p, token) {
|
|
1295
|
+
switch (token.type) {
|
|
1296
|
+
case require_token.TokenType.CHARACTER:
|
|
1297
|
+
characterInBody(p, token);
|
|
1298
|
+
break;
|
|
1299
|
+
case require_token.TokenType.WHITESPACE_CHARACTER:
|
|
1300
|
+
whitespaceCharacterInBody(p, token);
|
|
1301
|
+
break;
|
|
1302
|
+
case require_token.TokenType.COMMENT:
|
|
1303
|
+
appendComment(p, token);
|
|
1304
|
+
break;
|
|
1305
|
+
case require_token.TokenType.START_TAG:
|
|
1306
|
+
startTagInBody(p, token);
|
|
1307
|
+
break;
|
|
1308
|
+
case require_token.TokenType.END_TAG:
|
|
1309
|
+
endTagInBody(p, token);
|
|
1310
|
+
break;
|
|
1311
|
+
case require_token.TokenType.EOF:
|
|
1312
|
+
eofInBody(p, token);
|
|
1313
|
+
break;
|
|
1314
|
+
default:
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
function whitespaceCharacterInBody(p, token) {
|
|
1318
|
+
p._reconstructActiveFormattingElements();
|
|
1319
|
+
p._insertCharacters(token);
|
|
1320
|
+
}
|
|
1321
|
+
function characterInBody(p, token) {
|
|
1322
|
+
p._reconstructActiveFormattingElements();
|
|
1323
|
+
p._insertCharacters(token);
|
|
1324
|
+
p.framesetOk = false;
|
|
1325
|
+
}
|
|
1326
|
+
function htmlStartTagInBody(p, token) {
|
|
1327
|
+
if (p.openElements.tmplCount === 0) p.treeAdapter.adoptAttributes(p.openElements.items[0], token.attrs);
|
|
1328
|
+
}
|
|
1329
|
+
function bodyStartTagInBody(p, token) {
|
|
1330
|
+
const bodyElement = p.openElements.tryPeekProperlyNestedBodyElement();
|
|
1331
|
+
if (bodyElement && p.openElements.tmplCount === 0) {
|
|
1332
|
+
p.framesetOk = false;
|
|
1333
|
+
p.treeAdapter.adoptAttributes(bodyElement, token.attrs);
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
function framesetStartTagInBody(p, token) {
|
|
1337
|
+
const bodyElement = p.openElements.tryPeekProperlyNestedBodyElement();
|
|
1338
|
+
if (p.framesetOk && bodyElement) {
|
|
1339
|
+
p.treeAdapter.detachNode(bodyElement);
|
|
1340
|
+
p.openElements.popAllUpToHtmlElement();
|
|
1341
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1342
|
+
p.insertionMode = InsertionMode.IN_FRAMESET;
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
function addressStartTagInBody(p, token) {
|
|
1346
|
+
if (p.openElements.hasInButtonScope(require_html.TAG_ID.P)) p._closePElement();
|
|
1347
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1348
|
+
}
|
|
1349
|
+
function numberedHeaderStartTagInBody(p, token) {
|
|
1350
|
+
if (p.openElements.hasInButtonScope(require_html.TAG_ID.P)) p._closePElement();
|
|
1351
|
+
if (p.openElements.currentTagId !== void 0 && require_html.NUMBERED_HEADERS.has(p.openElements.currentTagId)) p.openElements.pop();
|
|
1352
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1353
|
+
}
|
|
1354
|
+
function preStartTagInBody(p, token) {
|
|
1355
|
+
if (p.openElements.hasInButtonScope(require_html.TAG_ID.P)) p._closePElement();
|
|
1356
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1357
|
+
p.skipNextNewLine = true;
|
|
1358
|
+
p.framesetOk = false;
|
|
1359
|
+
}
|
|
1360
|
+
function formStartTagInBody(p, token) {
|
|
1361
|
+
const inTemplate = p.openElements.tmplCount > 0;
|
|
1362
|
+
if (!p.formElement || inTemplate) {
|
|
1363
|
+
if (p.openElements.hasInButtonScope(require_html.TAG_ID.P)) p._closePElement();
|
|
1364
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1365
|
+
if (!inTemplate) p.formElement = p.openElements.current;
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
function listItemStartTagInBody(p, token) {
|
|
1369
|
+
p.framesetOk = false;
|
|
1370
|
+
const tn = token.tagID;
|
|
1371
|
+
for (let i = p.openElements.stackTop; i >= 0; i--) {
|
|
1372
|
+
const elementId = p.openElements.tagIDs[i];
|
|
1373
|
+
if (tn === require_html.TAG_ID.LI && elementId === require_html.TAG_ID.LI || (tn === require_html.TAG_ID.DD || tn === require_html.TAG_ID.DT) && (elementId === require_html.TAG_ID.DD || elementId === require_html.TAG_ID.DT)) {
|
|
1374
|
+
p.openElements.generateImpliedEndTagsWithExclusion(elementId);
|
|
1375
|
+
p.openElements.popUntilTagNamePopped(elementId);
|
|
1376
|
+
break;
|
|
1377
|
+
}
|
|
1378
|
+
if (elementId !== require_html.TAG_ID.ADDRESS && elementId !== require_html.TAG_ID.DIV && elementId !== require_html.TAG_ID.P && p._isSpecialElement(p.openElements.items[i], elementId)) break;
|
|
1379
|
+
}
|
|
1380
|
+
if (p.openElements.hasInButtonScope(require_html.TAG_ID.P)) p._closePElement();
|
|
1381
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1382
|
+
}
|
|
1383
|
+
function plaintextStartTagInBody(p, token) {
|
|
1384
|
+
if (p.openElements.hasInButtonScope(require_html.TAG_ID.P)) p._closePElement();
|
|
1385
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1386
|
+
p.tokenizer.state = require_index.TokenizerMode.PLAINTEXT;
|
|
1387
|
+
}
|
|
1388
|
+
function buttonStartTagInBody(p, token) {
|
|
1389
|
+
if (p.openElements.hasInScope(require_html.TAG_ID.BUTTON)) {
|
|
1390
|
+
p.openElements.generateImpliedEndTags();
|
|
1391
|
+
p.openElements.popUntilTagNamePopped(require_html.TAG_ID.BUTTON);
|
|
1392
|
+
}
|
|
1393
|
+
p._reconstructActiveFormattingElements();
|
|
1394
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1395
|
+
p.framesetOk = false;
|
|
1396
|
+
}
|
|
1397
|
+
function aStartTagInBody(p, token) {
|
|
1398
|
+
const activeElementEntry = p.activeFormattingElements.getElementEntryInScopeWithTagName(require_html.TAG_NAMES.A);
|
|
1399
|
+
if (activeElementEntry) {
|
|
1400
|
+
callAdoptionAgency(p, token);
|
|
1401
|
+
p.openElements.remove(activeElementEntry.element);
|
|
1402
|
+
p.activeFormattingElements.removeEntry(activeElementEntry);
|
|
1403
|
+
}
|
|
1404
|
+
p._reconstructActiveFormattingElements();
|
|
1405
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1406
|
+
p.activeFormattingElements.pushElement(p.openElements.current, token);
|
|
1407
|
+
}
|
|
1408
|
+
function bStartTagInBody(p, token) {
|
|
1409
|
+
p._reconstructActiveFormattingElements();
|
|
1410
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1411
|
+
p.activeFormattingElements.pushElement(p.openElements.current, token);
|
|
1412
|
+
}
|
|
1413
|
+
function nobrStartTagInBody(p, token) {
|
|
1414
|
+
p._reconstructActiveFormattingElements();
|
|
1415
|
+
if (p.openElements.hasInScope(require_html.TAG_ID.NOBR)) {
|
|
1416
|
+
callAdoptionAgency(p, token);
|
|
1417
|
+
p._reconstructActiveFormattingElements();
|
|
1418
|
+
}
|
|
1419
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1420
|
+
p.activeFormattingElements.pushElement(p.openElements.current, token);
|
|
1421
|
+
}
|
|
1422
|
+
function appletStartTagInBody(p, token) {
|
|
1423
|
+
p._reconstructActiveFormattingElements();
|
|
1424
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1425
|
+
p.activeFormattingElements.insertMarker();
|
|
1426
|
+
p.framesetOk = false;
|
|
1427
|
+
}
|
|
1428
|
+
function tableStartTagInBody(p, token) {
|
|
1429
|
+
if (p.treeAdapter.getDocumentMode(p.document) !== require_html.DOCUMENT_MODE.QUIRKS && p.openElements.hasInButtonScope(require_html.TAG_ID.P)) p._closePElement();
|
|
1430
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1431
|
+
p.framesetOk = false;
|
|
1432
|
+
p.insertionMode = InsertionMode.IN_TABLE;
|
|
1433
|
+
}
|
|
1434
|
+
function areaStartTagInBody(p, token) {
|
|
1435
|
+
p._reconstructActiveFormattingElements();
|
|
1436
|
+
p._appendElement(token, require_html.NS.HTML);
|
|
1437
|
+
p.framesetOk = false;
|
|
1438
|
+
token.ackSelfClosing = true;
|
|
1439
|
+
}
|
|
1440
|
+
function isHiddenInput(token) {
|
|
1441
|
+
const inputType = require_token.getTokenAttr(token, require_html.ATTRS.TYPE);
|
|
1442
|
+
return inputType != null && inputType.toLowerCase() === HIDDEN_INPUT_TYPE;
|
|
1443
|
+
}
|
|
1444
|
+
function inputStartTagInBody(p, token) {
|
|
1445
|
+
p._reconstructActiveFormattingElements();
|
|
1446
|
+
p._appendElement(token, require_html.NS.HTML);
|
|
1447
|
+
if (!isHiddenInput(token)) p.framesetOk = false;
|
|
1448
|
+
token.ackSelfClosing = true;
|
|
1449
|
+
}
|
|
1450
|
+
function paramStartTagInBody(p, token) {
|
|
1451
|
+
p._appendElement(token, require_html.NS.HTML);
|
|
1452
|
+
token.ackSelfClosing = true;
|
|
1453
|
+
}
|
|
1454
|
+
function hrStartTagInBody(p, token) {
|
|
1455
|
+
if (p.openElements.hasInButtonScope(require_html.TAG_ID.P)) p._closePElement();
|
|
1456
|
+
p._appendElement(token, require_html.NS.HTML);
|
|
1457
|
+
p.framesetOk = false;
|
|
1458
|
+
token.ackSelfClosing = true;
|
|
1459
|
+
}
|
|
1460
|
+
function imageStartTagInBody(p, token) {
|
|
1461
|
+
token.tagName = require_html.TAG_NAMES.IMG;
|
|
1462
|
+
token.tagID = require_html.TAG_ID.IMG;
|
|
1463
|
+
areaStartTagInBody(p, token);
|
|
1464
|
+
}
|
|
1465
|
+
function textareaStartTagInBody(p, token) {
|
|
1466
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1467
|
+
p.skipNextNewLine = true;
|
|
1468
|
+
p.tokenizer.state = require_index.TokenizerMode.RCDATA;
|
|
1469
|
+
p.originalInsertionMode = p.insertionMode;
|
|
1470
|
+
p.framesetOk = false;
|
|
1471
|
+
p.insertionMode = InsertionMode.TEXT;
|
|
1472
|
+
}
|
|
1473
|
+
function xmpStartTagInBody(p, token) {
|
|
1474
|
+
if (p.openElements.hasInButtonScope(require_html.TAG_ID.P)) p._closePElement();
|
|
1475
|
+
p._reconstructActiveFormattingElements();
|
|
1476
|
+
p.framesetOk = false;
|
|
1477
|
+
p._switchToTextParsing(token, require_index.TokenizerMode.RAWTEXT);
|
|
1478
|
+
}
|
|
1479
|
+
function iframeStartTagInBody(p, token) {
|
|
1480
|
+
p.framesetOk = false;
|
|
1481
|
+
p._switchToTextParsing(token, require_index.TokenizerMode.RAWTEXT);
|
|
1482
|
+
}
|
|
1483
|
+
function rawTextStartTagInBody(p, token) {
|
|
1484
|
+
p._switchToTextParsing(token, require_index.TokenizerMode.RAWTEXT);
|
|
1485
|
+
}
|
|
1486
|
+
function selectStartTagInBody(p, token) {
|
|
1487
|
+
p._reconstructActiveFormattingElements();
|
|
1488
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1489
|
+
p.framesetOk = false;
|
|
1490
|
+
p.insertionMode = p.insertionMode === InsertionMode.IN_TABLE || p.insertionMode === InsertionMode.IN_CAPTION || p.insertionMode === InsertionMode.IN_TABLE_BODY || p.insertionMode === InsertionMode.IN_ROW || p.insertionMode === InsertionMode.IN_CELL ? InsertionMode.IN_SELECT_IN_TABLE : InsertionMode.IN_SELECT;
|
|
1491
|
+
}
|
|
1492
|
+
function optgroupStartTagInBody(p, token) {
|
|
1493
|
+
if (p.openElements.currentTagId === require_html.TAG_ID.OPTION) p.openElements.pop();
|
|
1494
|
+
p._reconstructActiveFormattingElements();
|
|
1495
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1496
|
+
}
|
|
1497
|
+
function rbStartTagInBody(p, token) {
|
|
1498
|
+
if (p.openElements.hasInScope(require_html.TAG_ID.RUBY)) p.openElements.generateImpliedEndTags();
|
|
1499
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1500
|
+
}
|
|
1501
|
+
function rtStartTagInBody(p, token) {
|
|
1502
|
+
if (p.openElements.hasInScope(require_html.TAG_ID.RUBY)) p.openElements.generateImpliedEndTagsWithExclusion(require_html.TAG_ID.RTC);
|
|
1503
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1504
|
+
}
|
|
1505
|
+
function mathStartTagInBody(p, token) {
|
|
1506
|
+
p._reconstructActiveFormattingElements();
|
|
1507
|
+
require_foreign_content.adjustTokenMathMLAttrs(token);
|
|
1508
|
+
require_foreign_content.adjustTokenXMLAttrs(token);
|
|
1509
|
+
if (token.selfClosing) p._appendElement(token, require_html.NS.MATHML);
|
|
1510
|
+
else p._insertElement(token, require_html.NS.MATHML);
|
|
1511
|
+
token.ackSelfClosing = true;
|
|
1512
|
+
}
|
|
1513
|
+
function svgStartTagInBody(p, token) {
|
|
1514
|
+
p._reconstructActiveFormattingElements();
|
|
1515
|
+
require_foreign_content.adjustTokenSVGAttrs(token);
|
|
1516
|
+
require_foreign_content.adjustTokenXMLAttrs(token);
|
|
1517
|
+
if (token.selfClosing) p._appendElement(token, require_html.NS.SVG);
|
|
1518
|
+
else p._insertElement(token, require_html.NS.SVG);
|
|
1519
|
+
token.ackSelfClosing = true;
|
|
1520
|
+
}
|
|
1521
|
+
function genericStartTagInBody(p, token) {
|
|
1522
|
+
p._reconstructActiveFormattingElements();
|
|
1523
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1524
|
+
}
|
|
1525
|
+
function startTagInBody(p, token) {
|
|
1526
|
+
switch (token.tagID) {
|
|
1527
|
+
case require_html.TAG_ID.I:
|
|
1528
|
+
case require_html.TAG_ID.S:
|
|
1529
|
+
case require_html.TAG_ID.B:
|
|
1530
|
+
case require_html.TAG_ID.U:
|
|
1531
|
+
case require_html.TAG_ID.EM:
|
|
1532
|
+
case require_html.TAG_ID.TT:
|
|
1533
|
+
case require_html.TAG_ID.BIG:
|
|
1534
|
+
case require_html.TAG_ID.CODE:
|
|
1535
|
+
case require_html.TAG_ID.FONT:
|
|
1536
|
+
case require_html.TAG_ID.SMALL:
|
|
1537
|
+
case require_html.TAG_ID.STRIKE:
|
|
1538
|
+
case require_html.TAG_ID.STRONG:
|
|
1539
|
+
bStartTagInBody(p, token);
|
|
1540
|
+
break;
|
|
1541
|
+
case require_html.TAG_ID.A:
|
|
1542
|
+
aStartTagInBody(p, token);
|
|
1543
|
+
break;
|
|
1544
|
+
case require_html.TAG_ID.H1:
|
|
1545
|
+
case require_html.TAG_ID.H2:
|
|
1546
|
+
case require_html.TAG_ID.H3:
|
|
1547
|
+
case require_html.TAG_ID.H4:
|
|
1548
|
+
case require_html.TAG_ID.H5:
|
|
1549
|
+
case require_html.TAG_ID.H6:
|
|
1550
|
+
numberedHeaderStartTagInBody(p, token);
|
|
1551
|
+
break;
|
|
1552
|
+
case require_html.TAG_ID.P:
|
|
1553
|
+
case require_html.TAG_ID.DL:
|
|
1554
|
+
case require_html.TAG_ID.OL:
|
|
1555
|
+
case require_html.TAG_ID.UL:
|
|
1556
|
+
case require_html.TAG_ID.DIV:
|
|
1557
|
+
case require_html.TAG_ID.DIR:
|
|
1558
|
+
case require_html.TAG_ID.NAV:
|
|
1559
|
+
case require_html.TAG_ID.MAIN:
|
|
1560
|
+
case require_html.TAG_ID.MENU:
|
|
1561
|
+
case require_html.TAG_ID.ASIDE:
|
|
1562
|
+
case require_html.TAG_ID.CENTER:
|
|
1563
|
+
case require_html.TAG_ID.FIGURE:
|
|
1564
|
+
case require_html.TAG_ID.FOOTER:
|
|
1565
|
+
case require_html.TAG_ID.HEADER:
|
|
1566
|
+
case require_html.TAG_ID.HGROUP:
|
|
1567
|
+
case require_html.TAG_ID.DIALOG:
|
|
1568
|
+
case require_html.TAG_ID.DETAILS:
|
|
1569
|
+
case require_html.TAG_ID.ADDRESS:
|
|
1570
|
+
case require_html.TAG_ID.ARTICLE:
|
|
1571
|
+
case require_html.TAG_ID.SEARCH:
|
|
1572
|
+
case require_html.TAG_ID.SECTION:
|
|
1573
|
+
case require_html.TAG_ID.SUMMARY:
|
|
1574
|
+
case require_html.TAG_ID.FIELDSET:
|
|
1575
|
+
case require_html.TAG_ID.BLOCKQUOTE:
|
|
1576
|
+
case require_html.TAG_ID.FIGCAPTION:
|
|
1577
|
+
addressStartTagInBody(p, token);
|
|
1578
|
+
break;
|
|
1579
|
+
case require_html.TAG_ID.LI:
|
|
1580
|
+
case require_html.TAG_ID.DD:
|
|
1581
|
+
case require_html.TAG_ID.DT:
|
|
1582
|
+
listItemStartTagInBody(p, token);
|
|
1583
|
+
break;
|
|
1584
|
+
case require_html.TAG_ID.BR:
|
|
1585
|
+
case require_html.TAG_ID.IMG:
|
|
1586
|
+
case require_html.TAG_ID.WBR:
|
|
1587
|
+
case require_html.TAG_ID.AREA:
|
|
1588
|
+
case require_html.TAG_ID.EMBED:
|
|
1589
|
+
case require_html.TAG_ID.KEYGEN:
|
|
1590
|
+
areaStartTagInBody(p, token);
|
|
1591
|
+
break;
|
|
1592
|
+
case require_html.TAG_ID.HR:
|
|
1593
|
+
hrStartTagInBody(p, token);
|
|
1594
|
+
break;
|
|
1595
|
+
case require_html.TAG_ID.RB:
|
|
1596
|
+
case require_html.TAG_ID.RTC:
|
|
1597
|
+
rbStartTagInBody(p, token);
|
|
1598
|
+
break;
|
|
1599
|
+
case require_html.TAG_ID.RT:
|
|
1600
|
+
case require_html.TAG_ID.RP:
|
|
1601
|
+
rtStartTagInBody(p, token);
|
|
1602
|
+
break;
|
|
1603
|
+
case require_html.TAG_ID.PRE:
|
|
1604
|
+
case require_html.TAG_ID.LISTING:
|
|
1605
|
+
preStartTagInBody(p, token);
|
|
1606
|
+
break;
|
|
1607
|
+
case require_html.TAG_ID.XMP:
|
|
1608
|
+
xmpStartTagInBody(p, token);
|
|
1609
|
+
break;
|
|
1610
|
+
case require_html.TAG_ID.SVG:
|
|
1611
|
+
svgStartTagInBody(p, token);
|
|
1612
|
+
break;
|
|
1613
|
+
case require_html.TAG_ID.HTML:
|
|
1614
|
+
htmlStartTagInBody(p, token);
|
|
1615
|
+
break;
|
|
1616
|
+
case require_html.TAG_ID.BASE:
|
|
1617
|
+
case require_html.TAG_ID.LINK:
|
|
1618
|
+
case require_html.TAG_ID.META:
|
|
1619
|
+
case require_html.TAG_ID.STYLE:
|
|
1620
|
+
case require_html.TAG_ID.TITLE:
|
|
1621
|
+
case require_html.TAG_ID.SCRIPT:
|
|
1622
|
+
case require_html.TAG_ID.BGSOUND:
|
|
1623
|
+
case require_html.TAG_ID.BASEFONT:
|
|
1624
|
+
case require_html.TAG_ID.TEMPLATE:
|
|
1625
|
+
startTagInHead(p, token);
|
|
1626
|
+
break;
|
|
1627
|
+
case require_html.TAG_ID.BODY:
|
|
1628
|
+
bodyStartTagInBody(p, token);
|
|
1629
|
+
break;
|
|
1630
|
+
case require_html.TAG_ID.FORM:
|
|
1631
|
+
formStartTagInBody(p, token);
|
|
1632
|
+
break;
|
|
1633
|
+
case require_html.TAG_ID.NOBR:
|
|
1634
|
+
nobrStartTagInBody(p, token);
|
|
1635
|
+
break;
|
|
1636
|
+
case require_html.TAG_ID.MATH:
|
|
1637
|
+
mathStartTagInBody(p, token);
|
|
1638
|
+
break;
|
|
1639
|
+
case require_html.TAG_ID.TABLE:
|
|
1640
|
+
tableStartTagInBody(p, token);
|
|
1641
|
+
break;
|
|
1642
|
+
case require_html.TAG_ID.INPUT:
|
|
1643
|
+
inputStartTagInBody(p, token);
|
|
1644
|
+
break;
|
|
1645
|
+
case require_html.TAG_ID.PARAM:
|
|
1646
|
+
case require_html.TAG_ID.TRACK:
|
|
1647
|
+
case require_html.TAG_ID.SOURCE:
|
|
1648
|
+
paramStartTagInBody(p, token);
|
|
1649
|
+
break;
|
|
1650
|
+
case require_html.TAG_ID.IMAGE:
|
|
1651
|
+
imageStartTagInBody(p, token);
|
|
1652
|
+
break;
|
|
1653
|
+
case require_html.TAG_ID.BUTTON:
|
|
1654
|
+
buttonStartTagInBody(p, token);
|
|
1655
|
+
break;
|
|
1656
|
+
case require_html.TAG_ID.APPLET:
|
|
1657
|
+
case require_html.TAG_ID.OBJECT:
|
|
1658
|
+
case require_html.TAG_ID.MARQUEE:
|
|
1659
|
+
appletStartTagInBody(p, token);
|
|
1660
|
+
break;
|
|
1661
|
+
case require_html.TAG_ID.IFRAME:
|
|
1662
|
+
iframeStartTagInBody(p, token);
|
|
1663
|
+
break;
|
|
1664
|
+
case require_html.TAG_ID.SELECT:
|
|
1665
|
+
selectStartTagInBody(p, token);
|
|
1666
|
+
break;
|
|
1667
|
+
case require_html.TAG_ID.OPTION:
|
|
1668
|
+
case require_html.TAG_ID.OPTGROUP:
|
|
1669
|
+
optgroupStartTagInBody(p, token);
|
|
1670
|
+
break;
|
|
1671
|
+
case require_html.TAG_ID.NOEMBED:
|
|
1672
|
+
case require_html.TAG_ID.NOFRAMES:
|
|
1673
|
+
rawTextStartTagInBody(p, token);
|
|
1674
|
+
break;
|
|
1675
|
+
case require_html.TAG_ID.FRAMESET:
|
|
1676
|
+
framesetStartTagInBody(p, token);
|
|
1677
|
+
break;
|
|
1678
|
+
case require_html.TAG_ID.TEXTAREA:
|
|
1679
|
+
textareaStartTagInBody(p, token);
|
|
1680
|
+
break;
|
|
1681
|
+
case require_html.TAG_ID.NOSCRIPT:
|
|
1682
|
+
if (p.options.scriptingEnabled) rawTextStartTagInBody(p, token);
|
|
1683
|
+
else genericStartTagInBody(p, token);
|
|
1684
|
+
break;
|
|
1685
|
+
case require_html.TAG_ID.PLAINTEXT:
|
|
1686
|
+
plaintextStartTagInBody(p, token);
|
|
1687
|
+
break;
|
|
1688
|
+
case require_html.TAG_ID.COL:
|
|
1689
|
+
case require_html.TAG_ID.TH:
|
|
1690
|
+
case require_html.TAG_ID.TD:
|
|
1691
|
+
case require_html.TAG_ID.TR:
|
|
1692
|
+
case require_html.TAG_ID.HEAD:
|
|
1693
|
+
case require_html.TAG_ID.FRAME:
|
|
1694
|
+
case require_html.TAG_ID.TBODY:
|
|
1695
|
+
case require_html.TAG_ID.TFOOT:
|
|
1696
|
+
case require_html.TAG_ID.THEAD:
|
|
1697
|
+
case require_html.TAG_ID.CAPTION:
|
|
1698
|
+
case require_html.TAG_ID.COLGROUP: break;
|
|
1699
|
+
default: genericStartTagInBody(p, token);
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
function bodyEndTagInBody(p, token) {
|
|
1703
|
+
if (p.openElements.hasInScope(require_html.TAG_ID.BODY)) {
|
|
1704
|
+
p.insertionMode = InsertionMode.AFTER_BODY;
|
|
1705
|
+
if (p.options.sourceCodeLocationInfo) {
|
|
1706
|
+
const bodyElement = p.openElements.tryPeekProperlyNestedBodyElement();
|
|
1707
|
+
if (bodyElement) p._setEndLocation(bodyElement, token);
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
function htmlEndTagInBody(p, token) {
|
|
1712
|
+
if (p.openElements.hasInScope(require_html.TAG_ID.BODY)) {
|
|
1713
|
+
p.insertionMode = InsertionMode.AFTER_BODY;
|
|
1714
|
+
endTagAfterBody(p, token);
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
function addressEndTagInBody(p, token) {
|
|
1718
|
+
const tn = token.tagID;
|
|
1719
|
+
if (p.openElements.hasInScope(tn)) {
|
|
1720
|
+
p.openElements.generateImpliedEndTags();
|
|
1721
|
+
p.openElements.popUntilTagNamePopped(tn);
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
function formEndTagInBody(p) {
|
|
1725
|
+
const inTemplate = p.openElements.tmplCount > 0;
|
|
1726
|
+
const { formElement } = p;
|
|
1727
|
+
if (!inTemplate) p.formElement = null;
|
|
1728
|
+
if ((formElement || inTemplate) && p.openElements.hasInScope(require_html.TAG_ID.FORM)) {
|
|
1729
|
+
p.openElements.generateImpliedEndTags();
|
|
1730
|
+
if (inTemplate) p.openElements.popUntilTagNamePopped(require_html.TAG_ID.FORM);
|
|
1731
|
+
else if (formElement) p.openElements.remove(formElement);
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
function pEndTagInBody(p) {
|
|
1735
|
+
if (!p.openElements.hasInButtonScope(require_html.TAG_ID.P)) p._insertFakeElement(require_html.TAG_NAMES.P, require_html.TAG_ID.P);
|
|
1736
|
+
p._closePElement();
|
|
1737
|
+
}
|
|
1738
|
+
function liEndTagInBody(p) {
|
|
1739
|
+
if (p.openElements.hasInListItemScope(require_html.TAG_ID.LI)) {
|
|
1740
|
+
p.openElements.generateImpliedEndTagsWithExclusion(require_html.TAG_ID.LI);
|
|
1741
|
+
p.openElements.popUntilTagNamePopped(require_html.TAG_ID.LI);
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
function ddEndTagInBody(p, token) {
|
|
1745
|
+
const tn = token.tagID;
|
|
1746
|
+
if (p.openElements.hasInScope(tn)) {
|
|
1747
|
+
p.openElements.generateImpliedEndTagsWithExclusion(tn);
|
|
1748
|
+
p.openElements.popUntilTagNamePopped(tn);
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
function numberedHeaderEndTagInBody(p) {
|
|
1752
|
+
if (p.openElements.hasNumberedHeaderInScope()) {
|
|
1753
|
+
p.openElements.generateImpliedEndTags();
|
|
1754
|
+
p.openElements.popUntilNumberedHeaderPopped();
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
function appletEndTagInBody(p, token) {
|
|
1758
|
+
const tn = token.tagID;
|
|
1759
|
+
if (p.openElements.hasInScope(tn)) {
|
|
1760
|
+
p.openElements.generateImpliedEndTags();
|
|
1761
|
+
p.openElements.popUntilTagNamePopped(tn);
|
|
1762
|
+
p.activeFormattingElements.clearToLastMarker();
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
function brEndTagInBody(p) {
|
|
1766
|
+
p._reconstructActiveFormattingElements();
|
|
1767
|
+
p._insertFakeElement(require_html.TAG_NAMES.BR, require_html.TAG_ID.BR);
|
|
1768
|
+
p.openElements.pop();
|
|
1769
|
+
p.framesetOk = false;
|
|
1770
|
+
}
|
|
1771
|
+
function genericEndTagInBody(p, token) {
|
|
1772
|
+
const tn = token.tagName;
|
|
1773
|
+
const tid = token.tagID;
|
|
1774
|
+
for (let i = p.openElements.stackTop; i > 0; i--) {
|
|
1775
|
+
const element = p.openElements.items[i];
|
|
1776
|
+
const elementId = p.openElements.tagIDs[i];
|
|
1777
|
+
if (tid === elementId && (tid !== require_html.TAG_ID.UNKNOWN || p.treeAdapter.getTagName(element) === tn)) {
|
|
1778
|
+
p.openElements.generateImpliedEndTagsWithExclusion(tid);
|
|
1779
|
+
if (p.openElements.stackTop >= i) p.openElements.shortenToLength(i);
|
|
1780
|
+
break;
|
|
1781
|
+
}
|
|
1782
|
+
if (p._isSpecialElement(element, elementId)) break;
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
function endTagInBody(p, token) {
|
|
1786
|
+
switch (token.tagID) {
|
|
1787
|
+
case require_html.TAG_ID.A:
|
|
1788
|
+
case require_html.TAG_ID.B:
|
|
1789
|
+
case require_html.TAG_ID.I:
|
|
1790
|
+
case require_html.TAG_ID.S:
|
|
1791
|
+
case require_html.TAG_ID.U:
|
|
1792
|
+
case require_html.TAG_ID.EM:
|
|
1793
|
+
case require_html.TAG_ID.TT:
|
|
1794
|
+
case require_html.TAG_ID.BIG:
|
|
1795
|
+
case require_html.TAG_ID.CODE:
|
|
1796
|
+
case require_html.TAG_ID.FONT:
|
|
1797
|
+
case require_html.TAG_ID.NOBR:
|
|
1798
|
+
case require_html.TAG_ID.SMALL:
|
|
1799
|
+
case require_html.TAG_ID.STRIKE:
|
|
1800
|
+
case require_html.TAG_ID.STRONG:
|
|
1801
|
+
callAdoptionAgency(p, token);
|
|
1802
|
+
break;
|
|
1803
|
+
case require_html.TAG_ID.P:
|
|
1804
|
+
pEndTagInBody(p);
|
|
1805
|
+
break;
|
|
1806
|
+
case require_html.TAG_ID.DL:
|
|
1807
|
+
case require_html.TAG_ID.UL:
|
|
1808
|
+
case require_html.TAG_ID.OL:
|
|
1809
|
+
case require_html.TAG_ID.DIR:
|
|
1810
|
+
case require_html.TAG_ID.DIV:
|
|
1811
|
+
case require_html.TAG_ID.NAV:
|
|
1812
|
+
case require_html.TAG_ID.PRE:
|
|
1813
|
+
case require_html.TAG_ID.MAIN:
|
|
1814
|
+
case require_html.TAG_ID.MENU:
|
|
1815
|
+
case require_html.TAG_ID.ASIDE:
|
|
1816
|
+
case require_html.TAG_ID.BUTTON:
|
|
1817
|
+
case require_html.TAG_ID.CENTER:
|
|
1818
|
+
case require_html.TAG_ID.FIGURE:
|
|
1819
|
+
case require_html.TAG_ID.FOOTER:
|
|
1820
|
+
case require_html.TAG_ID.HEADER:
|
|
1821
|
+
case require_html.TAG_ID.HGROUP:
|
|
1822
|
+
case require_html.TAG_ID.DIALOG:
|
|
1823
|
+
case require_html.TAG_ID.ADDRESS:
|
|
1824
|
+
case require_html.TAG_ID.ARTICLE:
|
|
1825
|
+
case require_html.TAG_ID.DETAILS:
|
|
1826
|
+
case require_html.TAG_ID.SEARCH:
|
|
1827
|
+
case require_html.TAG_ID.SECTION:
|
|
1828
|
+
case require_html.TAG_ID.SUMMARY:
|
|
1829
|
+
case require_html.TAG_ID.LISTING:
|
|
1830
|
+
case require_html.TAG_ID.FIELDSET:
|
|
1831
|
+
case require_html.TAG_ID.BLOCKQUOTE:
|
|
1832
|
+
case require_html.TAG_ID.FIGCAPTION:
|
|
1833
|
+
addressEndTagInBody(p, token);
|
|
1834
|
+
break;
|
|
1835
|
+
case require_html.TAG_ID.LI:
|
|
1836
|
+
liEndTagInBody(p);
|
|
1837
|
+
break;
|
|
1838
|
+
case require_html.TAG_ID.DD:
|
|
1839
|
+
case require_html.TAG_ID.DT:
|
|
1840
|
+
ddEndTagInBody(p, token);
|
|
1841
|
+
break;
|
|
1842
|
+
case require_html.TAG_ID.H1:
|
|
1843
|
+
case require_html.TAG_ID.H2:
|
|
1844
|
+
case require_html.TAG_ID.H3:
|
|
1845
|
+
case require_html.TAG_ID.H4:
|
|
1846
|
+
case require_html.TAG_ID.H5:
|
|
1847
|
+
case require_html.TAG_ID.H6:
|
|
1848
|
+
numberedHeaderEndTagInBody(p);
|
|
1849
|
+
break;
|
|
1850
|
+
case require_html.TAG_ID.BR:
|
|
1851
|
+
brEndTagInBody(p);
|
|
1852
|
+
break;
|
|
1853
|
+
case require_html.TAG_ID.BODY:
|
|
1854
|
+
bodyEndTagInBody(p, token);
|
|
1855
|
+
break;
|
|
1856
|
+
case require_html.TAG_ID.HTML:
|
|
1857
|
+
htmlEndTagInBody(p, token);
|
|
1858
|
+
break;
|
|
1859
|
+
case require_html.TAG_ID.FORM:
|
|
1860
|
+
formEndTagInBody(p);
|
|
1861
|
+
break;
|
|
1862
|
+
case require_html.TAG_ID.APPLET:
|
|
1863
|
+
case require_html.TAG_ID.OBJECT:
|
|
1864
|
+
case require_html.TAG_ID.MARQUEE:
|
|
1865
|
+
appletEndTagInBody(p, token);
|
|
1866
|
+
break;
|
|
1867
|
+
case require_html.TAG_ID.TEMPLATE:
|
|
1868
|
+
templateEndTagInHead(p, token);
|
|
1869
|
+
break;
|
|
1870
|
+
default: genericEndTagInBody(p, token);
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
function eofInBody(p, token) {
|
|
1874
|
+
if (p.tmplInsertionModeStack.length > 0) eofInTemplate(p, token);
|
|
1875
|
+
else stopParsing(p, token);
|
|
1876
|
+
}
|
|
1877
|
+
function endTagInText(p, token) {
|
|
1878
|
+
var _a;
|
|
1879
|
+
if (token.tagID === require_html.TAG_ID.SCRIPT) (_a = p.scriptHandler) === null || _a === void 0 || _a.call(p, p.openElements.current);
|
|
1880
|
+
p.openElements.pop();
|
|
1881
|
+
p.insertionMode = p.originalInsertionMode;
|
|
1882
|
+
}
|
|
1883
|
+
function eofInText(p, token) {
|
|
1884
|
+
p._err(token, require_error_codes.ERR.eofInElementThatCanContainOnlyText);
|
|
1885
|
+
p.openElements.pop();
|
|
1886
|
+
p.insertionMode = p.originalInsertionMode;
|
|
1887
|
+
p.onEof(token);
|
|
1888
|
+
}
|
|
1889
|
+
function characterInTable(p, token) {
|
|
1890
|
+
if (p.openElements.currentTagId !== void 0 && TABLE_STRUCTURE_TAGS.has(p.openElements.currentTagId)) {
|
|
1891
|
+
p.pendingCharacterTokens.length = 0;
|
|
1892
|
+
p.hasNonWhitespacePendingCharacterToken = false;
|
|
1893
|
+
p.originalInsertionMode = p.insertionMode;
|
|
1894
|
+
p.insertionMode = InsertionMode.IN_TABLE_TEXT;
|
|
1895
|
+
switch (token.type) {
|
|
1896
|
+
case require_token.TokenType.CHARACTER:
|
|
1897
|
+
characterInTableText(p, token);
|
|
1898
|
+
break;
|
|
1899
|
+
case require_token.TokenType.WHITESPACE_CHARACTER:
|
|
1900
|
+
whitespaceCharacterInTableText(p, token);
|
|
1901
|
+
break;
|
|
1902
|
+
}
|
|
1903
|
+
} else tokenInTable(p, token);
|
|
1904
|
+
}
|
|
1905
|
+
function captionStartTagInTable(p, token) {
|
|
1906
|
+
p.openElements.clearBackToTableContext();
|
|
1907
|
+
p.activeFormattingElements.insertMarker();
|
|
1908
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1909
|
+
p.insertionMode = InsertionMode.IN_CAPTION;
|
|
1910
|
+
}
|
|
1911
|
+
function colgroupStartTagInTable(p, token) {
|
|
1912
|
+
p.openElements.clearBackToTableContext();
|
|
1913
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1914
|
+
p.insertionMode = InsertionMode.IN_COLUMN_GROUP;
|
|
1915
|
+
}
|
|
1916
|
+
function colStartTagInTable(p, token) {
|
|
1917
|
+
p.openElements.clearBackToTableContext();
|
|
1918
|
+
p._insertFakeElement(require_html.TAG_NAMES.COLGROUP, require_html.TAG_ID.COLGROUP);
|
|
1919
|
+
p.insertionMode = InsertionMode.IN_COLUMN_GROUP;
|
|
1920
|
+
startTagInColumnGroup(p, token);
|
|
1921
|
+
}
|
|
1922
|
+
function tbodyStartTagInTable(p, token) {
|
|
1923
|
+
p.openElements.clearBackToTableContext();
|
|
1924
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1925
|
+
p.insertionMode = InsertionMode.IN_TABLE_BODY;
|
|
1926
|
+
}
|
|
1927
|
+
function tdStartTagInTable(p, token) {
|
|
1928
|
+
p.openElements.clearBackToTableContext();
|
|
1929
|
+
p._insertFakeElement(require_html.TAG_NAMES.TBODY, require_html.TAG_ID.TBODY);
|
|
1930
|
+
p.insertionMode = InsertionMode.IN_TABLE_BODY;
|
|
1931
|
+
startTagInTableBody(p, token);
|
|
1932
|
+
}
|
|
1933
|
+
function tableStartTagInTable(p, token) {
|
|
1934
|
+
if (p.openElements.hasInTableScope(require_html.TAG_ID.TABLE)) {
|
|
1935
|
+
p.openElements.popUntilTagNamePopped(require_html.TAG_ID.TABLE);
|
|
1936
|
+
p._resetInsertionMode();
|
|
1937
|
+
p._processStartTag(token);
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
function inputStartTagInTable(p, token) {
|
|
1941
|
+
if (isHiddenInput(token)) p._appendElement(token, require_html.NS.HTML);
|
|
1942
|
+
else tokenInTable(p, token);
|
|
1943
|
+
token.ackSelfClosing = true;
|
|
1944
|
+
}
|
|
1945
|
+
function formStartTagInTable(p, token) {
|
|
1946
|
+
if (!p.formElement && p.openElements.tmplCount === 0) {
|
|
1947
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
1948
|
+
p.formElement = p.openElements.current;
|
|
1949
|
+
p.openElements.pop();
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
function startTagInTable(p, token) {
|
|
1953
|
+
switch (token.tagID) {
|
|
1954
|
+
case require_html.TAG_ID.TD:
|
|
1955
|
+
case require_html.TAG_ID.TH:
|
|
1956
|
+
case require_html.TAG_ID.TR:
|
|
1957
|
+
tdStartTagInTable(p, token);
|
|
1958
|
+
break;
|
|
1959
|
+
case require_html.TAG_ID.STYLE:
|
|
1960
|
+
case require_html.TAG_ID.SCRIPT:
|
|
1961
|
+
case require_html.TAG_ID.TEMPLATE:
|
|
1962
|
+
startTagInHead(p, token);
|
|
1963
|
+
break;
|
|
1964
|
+
case require_html.TAG_ID.COL:
|
|
1965
|
+
colStartTagInTable(p, token);
|
|
1966
|
+
break;
|
|
1967
|
+
case require_html.TAG_ID.FORM:
|
|
1968
|
+
formStartTagInTable(p, token);
|
|
1969
|
+
break;
|
|
1970
|
+
case require_html.TAG_ID.TABLE:
|
|
1971
|
+
tableStartTagInTable(p, token);
|
|
1972
|
+
break;
|
|
1973
|
+
case require_html.TAG_ID.TBODY:
|
|
1974
|
+
case require_html.TAG_ID.TFOOT:
|
|
1975
|
+
case require_html.TAG_ID.THEAD:
|
|
1976
|
+
tbodyStartTagInTable(p, token);
|
|
1977
|
+
break;
|
|
1978
|
+
case require_html.TAG_ID.INPUT:
|
|
1979
|
+
inputStartTagInTable(p, token);
|
|
1980
|
+
break;
|
|
1981
|
+
case require_html.TAG_ID.CAPTION:
|
|
1982
|
+
captionStartTagInTable(p, token);
|
|
1983
|
+
break;
|
|
1984
|
+
case require_html.TAG_ID.COLGROUP:
|
|
1985
|
+
colgroupStartTagInTable(p, token);
|
|
1986
|
+
break;
|
|
1987
|
+
default: tokenInTable(p, token);
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
function endTagInTable(p, token) {
|
|
1991
|
+
switch (token.tagID) {
|
|
1992
|
+
case require_html.TAG_ID.TABLE:
|
|
1993
|
+
if (p.openElements.hasInTableScope(require_html.TAG_ID.TABLE)) {
|
|
1994
|
+
p.openElements.popUntilTagNamePopped(require_html.TAG_ID.TABLE);
|
|
1995
|
+
p._resetInsertionMode();
|
|
1996
|
+
}
|
|
1997
|
+
break;
|
|
1998
|
+
case require_html.TAG_ID.TEMPLATE:
|
|
1999
|
+
templateEndTagInHead(p, token);
|
|
2000
|
+
break;
|
|
2001
|
+
case require_html.TAG_ID.BODY:
|
|
2002
|
+
case require_html.TAG_ID.CAPTION:
|
|
2003
|
+
case require_html.TAG_ID.COL:
|
|
2004
|
+
case require_html.TAG_ID.COLGROUP:
|
|
2005
|
+
case require_html.TAG_ID.HTML:
|
|
2006
|
+
case require_html.TAG_ID.TBODY:
|
|
2007
|
+
case require_html.TAG_ID.TD:
|
|
2008
|
+
case require_html.TAG_ID.TFOOT:
|
|
2009
|
+
case require_html.TAG_ID.TH:
|
|
2010
|
+
case require_html.TAG_ID.THEAD:
|
|
2011
|
+
case require_html.TAG_ID.TR: break;
|
|
2012
|
+
default: tokenInTable(p, token);
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
2015
|
+
function tokenInTable(p, token) {
|
|
2016
|
+
const savedFosterParentingState = p.fosterParentingEnabled;
|
|
2017
|
+
p.fosterParentingEnabled = true;
|
|
2018
|
+
modeInBody(p, token);
|
|
2019
|
+
p.fosterParentingEnabled = savedFosterParentingState;
|
|
2020
|
+
}
|
|
2021
|
+
function whitespaceCharacterInTableText(p, token) {
|
|
2022
|
+
p.pendingCharacterTokens.push(token);
|
|
2023
|
+
}
|
|
2024
|
+
function characterInTableText(p, token) {
|
|
2025
|
+
p.pendingCharacterTokens.push(token);
|
|
2026
|
+
p.hasNonWhitespacePendingCharacterToken = true;
|
|
2027
|
+
}
|
|
2028
|
+
function tokenInTableText(p, token) {
|
|
2029
|
+
let i = 0;
|
|
2030
|
+
if (p.hasNonWhitespacePendingCharacterToken) for (; i < p.pendingCharacterTokens.length; i++) tokenInTable(p, p.pendingCharacterTokens[i]);
|
|
2031
|
+
else for (; i < p.pendingCharacterTokens.length; i++) p._insertCharacters(p.pendingCharacterTokens[i]);
|
|
2032
|
+
p.insertionMode = p.originalInsertionMode;
|
|
2033
|
+
p._processToken(token);
|
|
2034
|
+
}
|
|
2035
|
+
const TABLE_VOID_ELEMENTS = new Set([
|
|
2036
|
+
require_html.TAG_ID.CAPTION,
|
|
2037
|
+
require_html.TAG_ID.COL,
|
|
2038
|
+
require_html.TAG_ID.COLGROUP,
|
|
2039
|
+
require_html.TAG_ID.TBODY,
|
|
2040
|
+
require_html.TAG_ID.TD,
|
|
2041
|
+
require_html.TAG_ID.TFOOT,
|
|
2042
|
+
require_html.TAG_ID.TH,
|
|
2043
|
+
require_html.TAG_ID.THEAD,
|
|
2044
|
+
require_html.TAG_ID.TR
|
|
2045
|
+
]);
|
|
2046
|
+
function startTagInCaption(p, token) {
|
|
2047
|
+
const tn = token.tagID;
|
|
2048
|
+
if (TABLE_VOID_ELEMENTS.has(tn)) {
|
|
2049
|
+
if (p.openElements.hasInTableScope(require_html.TAG_ID.CAPTION)) {
|
|
2050
|
+
p.openElements.generateImpliedEndTags();
|
|
2051
|
+
p.openElements.popUntilTagNamePopped(require_html.TAG_ID.CAPTION);
|
|
2052
|
+
p.activeFormattingElements.clearToLastMarker();
|
|
2053
|
+
p.insertionMode = InsertionMode.IN_TABLE;
|
|
2054
|
+
startTagInTable(p, token);
|
|
2055
|
+
}
|
|
2056
|
+
} else startTagInBody(p, token);
|
|
2057
|
+
}
|
|
2058
|
+
function endTagInCaption(p, token) {
|
|
2059
|
+
const tn = token.tagID;
|
|
2060
|
+
switch (tn) {
|
|
2061
|
+
case require_html.TAG_ID.CAPTION:
|
|
2062
|
+
case require_html.TAG_ID.TABLE:
|
|
2063
|
+
if (p.openElements.hasInTableScope(require_html.TAG_ID.CAPTION)) {
|
|
2064
|
+
p.openElements.generateImpliedEndTags();
|
|
2065
|
+
p.openElements.popUntilTagNamePopped(require_html.TAG_ID.CAPTION);
|
|
2066
|
+
p.activeFormattingElements.clearToLastMarker();
|
|
2067
|
+
p.insertionMode = InsertionMode.IN_TABLE;
|
|
2068
|
+
if (tn === require_html.TAG_ID.TABLE) endTagInTable(p, token);
|
|
2069
|
+
}
|
|
2070
|
+
break;
|
|
2071
|
+
case require_html.TAG_ID.BODY:
|
|
2072
|
+
case require_html.TAG_ID.COL:
|
|
2073
|
+
case require_html.TAG_ID.COLGROUP:
|
|
2074
|
+
case require_html.TAG_ID.HTML:
|
|
2075
|
+
case require_html.TAG_ID.TBODY:
|
|
2076
|
+
case require_html.TAG_ID.TD:
|
|
2077
|
+
case require_html.TAG_ID.TFOOT:
|
|
2078
|
+
case require_html.TAG_ID.TH:
|
|
2079
|
+
case require_html.TAG_ID.THEAD:
|
|
2080
|
+
case require_html.TAG_ID.TR: break;
|
|
2081
|
+
default: endTagInBody(p, token);
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
function startTagInColumnGroup(p, token) {
|
|
2085
|
+
switch (token.tagID) {
|
|
2086
|
+
case require_html.TAG_ID.HTML:
|
|
2087
|
+
startTagInBody(p, token);
|
|
2088
|
+
break;
|
|
2089
|
+
case require_html.TAG_ID.COL:
|
|
2090
|
+
p._appendElement(token, require_html.NS.HTML);
|
|
2091
|
+
token.ackSelfClosing = true;
|
|
2092
|
+
break;
|
|
2093
|
+
case require_html.TAG_ID.TEMPLATE:
|
|
2094
|
+
startTagInHead(p, token);
|
|
2095
|
+
break;
|
|
2096
|
+
default: tokenInColumnGroup(p, token);
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
function endTagInColumnGroup(p, token) {
|
|
2100
|
+
switch (token.tagID) {
|
|
2101
|
+
case require_html.TAG_ID.COLGROUP:
|
|
2102
|
+
if (p.openElements.currentTagId === require_html.TAG_ID.COLGROUP) {
|
|
2103
|
+
p.openElements.pop();
|
|
2104
|
+
p.insertionMode = InsertionMode.IN_TABLE;
|
|
2105
|
+
}
|
|
2106
|
+
break;
|
|
2107
|
+
case require_html.TAG_ID.TEMPLATE:
|
|
2108
|
+
templateEndTagInHead(p, token);
|
|
2109
|
+
break;
|
|
2110
|
+
case require_html.TAG_ID.COL: break;
|
|
2111
|
+
default: tokenInColumnGroup(p, token);
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
function tokenInColumnGroup(p, token) {
|
|
2115
|
+
if (p.openElements.currentTagId === require_html.TAG_ID.COLGROUP) {
|
|
2116
|
+
p.openElements.pop();
|
|
2117
|
+
p.insertionMode = InsertionMode.IN_TABLE;
|
|
2118
|
+
p._processToken(token);
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
function startTagInTableBody(p, token) {
|
|
2122
|
+
switch (token.tagID) {
|
|
2123
|
+
case require_html.TAG_ID.TR:
|
|
2124
|
+
p.openElements.clearBackToTableBodyContext();
|
|
2125
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
2126
|
+
p.insertionMode = InsertionMode.IN_ROW;
|
|
2127
|
+
break;
|
|
2128
|
+
case require_html.TAG_ID.TH:
|
|
2129
|
+
case require_html.TAG_ID.TD:
|
|
2130
|
+
p.openElements.clearBackToTableBodyContext();
|
|
2131
|
+
p._insertFakeElement(require_html.TAG_NAMES.TR, require_html.TAG_ID.TR);
|
|
2132
|
+
p.insertionMode = InsertionMode.IN_ROW;
|
|
2133
|
+
startTagInRow(p, token);
|
|
2134
|
+
break;
|
|
2135
|
+
case require_html.TAG_ID.CAPTION:
|
|
2136
|
+
case require_html.TAG_ID.COL:
|
|
2137
|
+
case require_html.TAG_ID.COLGROUP:
|
|
2138
|
+
case require_html.TAG_ID.TBODY:
|
|
2139
|
+
case require_html.TAG_ID.TFOOT:
|
|
2140
|
+
case require_html.TAG_ID.THEAD:
|
|
2141
|
+
if (p.openElements.hasTableBodyContextInTableScope()) {
|
|
2142
|
+
p.openElements.clearBackToTableBodyContext();
|
|
2143
|
+
p.openElements.pop();
|
|
2144
|
+
p.insertionMode = InsertionMode.IN_TABLE;
|
|
2145
|
+
startTagInTable(p, token);
|
|
2146
|
+
}
|
|
2147
|
+
break;
|
|
2148
|
+
default: startTagInTable(p, token);
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
function endTagInTableBody(p, token) {
|
|
2152
|
+
const tn = token.tagID;
|
|
2153
|
+
switch (token.tagID) {
|
|
2154
|
+
case require_html.TAG_ID.TBODY:
|
|
2155
|
+
case require_html.TAG_ID.TFOOT:
|
|
2156
|
+
case require_html.TAG_ID.THEAD:
|
|
2157
|
+
if (p.openElements.hasInTableScope(tn)) {
|
|
2158
|
+
p.openElements.clearBackToTableBodyContext();
|
|
2159
|
+
p.openElements.pop();
|
|
2160
|
+
p.insertionMode = InsertionMode.IN_TABLE;
|
|
2161
|
+
}
|
|
2162
|
+
break;
|
|
2163
|
+
case require_html.TAG_ID.TABLE:
|
|
2164
|
+
if (p.openElements.hasTableBodyContextInTableScope()) {
|
|
2165
|
+
p.openElements.clearBackToTableBodyContext();
|
|
2166
|
+
p.openElements.pop();
|
|
2167
|
+
p.insertionMode = InsertionMode.IN_TABLE;
|
|
2168
|
+
endTagInTable(p, token);
|
|
2169
|
+
}
|
|
2170
|
+
break;
|
|
2171
|
+
case require_html.TAG_ID.BODY:
|
|
2172
|
+
case require_html.TAG_ID.CAPTION:
|
|
2173
|
+
case require_html.TAG_ID.COL:
|
|
2174
|
+
case require_html.TAG_ID.COLGROUP:
|
|
2175
|
+
case require_html.TAG_ID.HTML:
|
|
2176
|
+
case require_html.TAG_ID.TD:
|
|
2177
|
+
case require_html.TAG_ID.TH:
|
|
2178
|
+
case require_html.TAG_ID.TR: break;
|
|
2179
|
+
default: endTagInTable(p, token);
|
|
2180
|
+
}
|
|
2181
|
+
}
|
|
2182
|
+
function startTagInRow(p, token) {
|
|
2183
|
+
switch (token.tagID) {
|
|
2184
|
+
case require_html.TAG_ID.TH:
|
|
2185
|
+
case require_html.TAG_ID.TD:
|
|
2186
|
+
p.openElements.clearBackToTableRowContext();
|
|
2187
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
2188
|
+
p.insertionMode = InsertionMode.IN_CELL;
|
|
2189
|
+
p.activeFormattingElements.insertMarker();
|
|
2190
|
+
break;
|
|
2191
|
+
case require_html.TAG_ID.CAPTION:
|
|
2192
|
+
case require_html.TAG_ID.COL:
|
|
2193
|
+
case require_html.TAG_ID.COLGROUP:
|
|
2194
|
+
case require_html.TAG_ID.TBODY:
|
|
2195
|
+
case require_html.TAG_ID.TFOOT:
|
|
2196
|
+
case require_html.TAG_ID.THEAD:
|
|
2197
|
+
case require_html.TAG_ID.TR:
|
|
2198
|
+
if (p.openElements.hasInTableScope(require_html.TAG_ID.TR)) {
|
|
2199
|
+
p.openElements.clearBackToTableRowContext();
|
|
2200
|
+
p.openElements.pop();
|
|
2201
|
+
p.insertionMode = InsertionMode.IN_TABLE_BODY;
|
|
2202
|
+
startTagInTableBody(p, token);
|
|
2203
|
+
}
|
|
2204
|
+
break;
|
|
2205
|
+
default: startTagInTable(p, token);
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2208
|
+
function endTagInRow(p, token) {
|
|
2209
|
+
switch (token.tagID) {
|
|
2210
|
+
case require_html.TAG_ID.TR:
|
|
2211
|
+
if (p.openElements.hasInTableScope(require_html.TAG_ID.TR)) {
|
|
2212
|
+
p.openElements.clearBackToTableRowContext();
|
|
2213
|
+
p.openElements.pop();
|
|
2214
|
+
p.insertionMode = InsertionMode.IN_TABLE_BODY;
|
|
2215
|
+
}
|
|
2216
|
+
break;
|
|
2217
|
+
case require_html.TAG_ID.TABLE:
|
|
2218
|
+
if (p.openElements.hasInTableScope(require_html.TAG_ID.TR)) {
|
|
2219
|
+
p.openElements.clearBackToTableRowContext();
|
|
2220
|
+
p.openElements.pop();
|
|
2221
|
+
p.insertionMode = InsertionMode.IN_TABLE_BODY;
|
|
2222
|
+
endTagInTableBody(p, token);
|
|
2223
|
+
}
|
|
2224
|
+
break;
|
|
2225
|
+
case require_html.TAG_ID.TBODY:
|
|
2226
|
+
case require_html.TAG_ID.TFOOT:
|
|
2227
|
+
case require_html.TAG_ID.THEAD:
|
|
2228
|
+
if (p.openElements.hasInTableScope(token.tagID) || p.openElements.hasInTableScope(require_html.TAG_ID.TR)) {
|
|
2229
|
+
p.openElements.clearBackToTableRowContext();
|
|
2230
|
+
p.openElements.pop();
|
|
2231
|
+
p.insertionMode = InsertionMode.IN_TABLE_BODY;
|
|
2232
|
+
endTagInTableBody(p, token);
|
|
2233
|
+
}
|
|
2234
|
+
break;
|
|
2235
|
+
case require_html.TAG_ID.BODY:
|
|
2236
|
+
case require_html.TAG_ID.CAPTION:
|
|
2237
|
+
case require_html.TAG_ID.COL:
|
|
2238
|
+
case require_html.TAG_ID.COLGROUP:
|
|
2239
|
+
case require_html.TAG_ID.HTML:
|
|
2240
|
+
case require_html.TAG_ID.TD:
|
|
2241
|
+
case require_html.TAG_ID.TH: break;
|
|
2242
|
+
default: endTagInTable(p, token);
|
|
2243
|
+
}
|
|
2244
|
+
}
|
|
2245
|
+
function startTagInCell(p, token) {
|
|
2246
|
+
const tn = token.tagID;
|
|
2247
|
+
if (TABLE_VOID_ELEMENTS.has(tn)) {
|
|
2248
|
+
if (p.openElements.hasInTableScope(require_html.TAG_ID.TD) || p.openElements.hasInTableScope(require_html.TAG_ID.TH)) {
|
|
2249
|
+
p._closeTableCell();
|
|
2250
|
+
startTagInRow(p, token);
|
|
2251
|
+
}
|
|
2252
|
+
} else startTagInBody(p, token);
|
|
2253
|
+
}
|
|
2254
|
+
function endTagInCell(p, token) {
|
|
2255
|
+
const tn = token.tagID;
|
|
2256
|
+
switch (tn) {
|
|
2257
|
+
case require_html.TAG_ID.TD:
|
|
2258
|
+
case require_html.TAG_ID.TH:
|
|
2259
|
+
if (p.openElements.hasInTableScope(tn)) {
|
|
2260
|
+
p.openElements.generateImpliedEndTags();
|
|
2261
|
+
p.openElements.popUntilTagNamePopped(tn);
|
|
2262
|
+
p.activeFormattingElements.clearToLastMarker();
|
|
2263
|
+
p.insertionMode = InsertionMode.IN_ROW;
|
|
2264
|
+
}
|
|
2265
|
+
break;
|
|
2266
|
+
case require_html.TAG_ID.TABLE:
|
|
2267
|
+
case require_html.TAG_ID.TBODY:
|
|
2268
|
+
case require_html.TAG_ID.TFOOT:
|
|
2269
|
+
case require_html.TAG_ID.THEAD:
|
|
2270
|
+
case require_html.TAG_ID.TR:
|
|
2271
|
+
if (p.openElements.hasInTableScope(tn)) {
|
|
2272
|
+
p._closeTableCell();
|
|
2273
|
+
endTagInRow(p, token);
|
|
2274
|
+
}
|
|
2275
|
+
break;
|
|
2276
|
+
case require_html.TAG_ID.BODY:
|
|
2277
|
+
case require_html.TAG_ID.CAPTION:
|
|
2278
|
+
case require_html.TAG_ID.COL:
|
|
2279
|
+
case require_html.TAG_ID.COLGROUP:
|
|
2280
|
+
case require_html.TAG_ID.HTML: break;
|
|
2281
|
+
default: endTagInBody(p, token);
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
function startTagInSelect(p, token) {
|
|
2285
|
+
switch (token.tagID) {
|
|
2286
|
+
case require_html.TAG_ID.HTML:
|
|
2287
|
+
startTagInBody(p, token);
|
|
2288
|
+
break;
|
|
2289
|
+
case require_html.TAG_ID.OPTION:
|
|
2290
|
+
if (p.openElements.currentTagId === require_html.TAG_ID.OPTION) p.openElements.pop();
|
|
2291
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
2292
|
+
break;
|
|
2293
|
+
case require_html.TAG_ID.OPTGROUP:
|
|
2294
|
+
if (p.openElements.currentTagId === require_html.TAG_ID.OPTION) p.openElements.pop();
|
|
2295
|
+
if (p.openElements.currentTagId === require_html.TAG_ID.OPTGROUP) p.openElements.pop();
|
|
2296
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
2297
|
+
break;
|
|
2298
|
+
case require_html.TAG_ID.HR:
|
|
2299
|
+
if (p.openElements.currentTagId === require_html.TAG_ID.OPTION) p.openElements.pop();
|
|
2300
|
+
if (p.openElements.currentTagId === require_html.TAG_ID.OPTGROUP) p.openElements.pop();
|
|
2301
|
+
p._appendElement(token, require_html.NS.HTML);
|
|
2302
|
+
token.ackSelfClosing = true;
|
|
2303
|
+
break;
|
|
2304
|
+
case require_html.TAG_ID.INPUT:
|
|
2305
|
+
case require_html.TAG_ID.KEYGEN:
|
|
2306
|
+
case require_html.TAG_ID.TEXTAREA:
|
|
2307
|
+
case require_html.TAG_ID.SELECT:
|
|
2308
|
+
if (p.openElements.hasInSelectScope(require_html.TAG_ID.SELECT)) {
|
|
2309
|
+
p.openElements.popUntilTagNamePopped(require_html.TAG_ID.SELECT);
|
|
2310
|
+
p._resetInsertionMode();
|
|
2311
|
+
if (token.tagID !== require_html.TAG_ID.SELECT) p._processStartTag(token);
|
|
2312
|
+
}
|
|
2313
|
+
break;
|
|
2314
|
+
case require_html.TAG_ID.SCRIPT:
|
|
2315
|
+
case require_html.TAG_ID.TEMPLATE:
|
|
2316
|
+
startTagInHead(p, token);
|
|
2317
|
+
break;
|
|
2318
|
+
default:
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
function endTagInSelect(p, token) {
|
|
2322
|
+
switch (token.tagID) {
|
|
2323
|
+
case require_html.TAG_ID.OPTGROUP:
|
|
2324
|
+
if (p.openElements.stackTop > 0 && p.openElements.currentTagId === require_html.TAG_ID.OPTION && p.openElements.tagIDs[p.openElements.stackTop - 1] === require_html.TAG_ID.OPTGROUP) p.openElements.pop();
|
|
2325
|
+
if (p.openElements.currentTagId === require_html.TAG_ID.OPTGROUP) p.openElements.pop();
|
|
2326
|
+
break;
|
|
2327
|
+
case require_html.TAG_ID.OPTION:
|
|
2328
|
+
if (p.openElements.currentTagId === require_html.TAG_ID.OPTION) p.openElements.pop();
|
|
2329
|
+
break;
|
|
2330
|
+
case require_html.TAG_ID.SELECT:
|
|
2331
|
+
if (p.openElements.hasInSelectScope(require_html.TAG_ID.SELECT)) {
|
|
2332
|
+
p.openElements.popUntilTagNamePopped(require_html.TAG_ID.SELECT);
|
|
2333
|
+
p._resetInsertionMode();
|
|
2334
|
+
}
|
|
2335
|
+
break;
|
|
2336
|
+
case require_html.TAG_ID.TEMPLATE:
|
|
2337
|
+
templateEndTagInHead(p, token);
|
|
2338
|
+
break;
|
|
2339
|
+
default:
|
|
2340
|
+
}
|
|
2341
|
+
}
|
|
2342
|
+
function startTagInSelectInTable(p, token) {
|
|
2343
|
+
const tn = token.tagID;
|
|
2344
|
+
if (tn === require_html.TAG_ID.CAPTION || tn === require_html.TAG_ID.TABLE || tn === require_html.TAG_ID.TBODY || tn === require_html.TAG_ID.TFOOT || tn === require_html.TAG_ID.THEAD || tn === require_html.TAG_ID.TR || tn === require_html.TAG_ID.TD || tn === require_html.TAG_ID.TH) {
|
|
2345
|
+
p.openElements.popUntilTagNamePopped(require_html.TAG_ID.SELECT);
|
|
2346
|
+
p._resetInsertionMode();
|
|
2347
|
+
p._processStartTag(token);
|
|
2348
|
+
} else startTagInSelect(p, token);
|
|
2349
|
+
}
|
|
2350
|
+
function endTagInSelectInTable(p, token) {
|
|
2351
|
+
const tn = token.tagID;
|
|
2352
|
+
if (tn === require_html.TAG_ID.CAPTION || tn === require_html.TAG_ID.TABLE || tn === require_html.TAG_ID.TBODY || tn === require_html.TAG_ID.TFOOT || tn === require_html.TAG_ID.THEAD || tn === require_html.TAG_ID.TR || tn === require_html.TAG_ID.TD || tn === require_html.TAG_ID.TH) {
|
|
2353
|
+
if (p.openElements.hasInTableScope(tn)) {
|
|
2354
|
+
p.openElements.popUntilTagNamePopped(require_html.TAG_ID.SELECT);
|
|
2355
|
+
p._resetInsertionMode();
|
|
2356
|
+
p.onEndTag(token);
|
|
2357
|
+
}
|
|
2358
|
+
} else endTagInSelect(p, token);
|
|
2359
|
+
}
|
|
2360
|
+
function startTagInTemplate(p, token) {
|
|
2361
|
+
switch (token.tagID) {
|
|
2362
|
+
case require_html.TAG_ID.BASE:
|
|
2363
|
+
case require_html.TAG_ID.BASEFONT:
|
|
2364
|
+
case require_html.TAG_ID.BGSOUND:
|
|
2365
|
+
case require_html.TAG_ID.LINK:
|
|
2366
|
+
case require_html.TAG_ID.META:
|
|
2367
|
+
case require_html.TAG_ID.NOFRAMES:
|
|
2368
|
+
case require_html.TAG_ID.SCRIPT:
|
|
2369
|
+
case require_html.TAG_ID.STYLE:
|
|
2370
|
+
case require_html.TAG_ID.TEMPLATE:
|
|
2371
|
+
case require_html.TAG_ID.TITLE:
|
|
2372
|
+
startTagInHead(p, token);
|
|
2373
|
+
break;
|
|
2374
|
+
case require_html.TAG_ID.CAPTION:
|
|
2375
|
+
case require_html.TAG_ID.COLGROUP:
|
|
2376
|
+
case require_html.TAG_ID.TBODY:
|
|
2377
|
+
case require_html.TAG_ID.TFOOT:
|
|
2378
|
+
case require_html.TAG_ID.THEAD:
|
|
2379
|
+
p.tmplInsertionModeStack[0] = InsertionMode.IN_TABLE;
|
|
2380
|
+
p.insertionMode = InsertionMode.IN_TABLE;
|
|
2381
|
+
startTagInTable(p, token);
|
|
2382
|
+
break;
|
|
2383
|
+
case require_html.TAG_ID.COL:
|
|
2384
|
+
p.tmplInsertionModeStack[0] = InsertionMode.IN_COLUMN_GROUP;
|
|
2385
|
+
p.insertionMode = InsertionMode.IN_COLUMN_GROUP;
|
|
2386
|
+
startTagInColumnGroup(p, token);
|
|
2387
|
+
break;
|
|
2388
|
+
case require_html.TAG_ID.TR:
|
|
2389
|
+
p.tmplInsertionModeStack[0] = InsertionMode.IN_TABLE_BODY;
|
|
2390
|
+
p.insertionMode = InsertionMode.IN_TABLE_BODY;
|
|
2391
|
+
startTagInTableBody(p, token);
|
|
2392
|
+
break;
|
|
2393
|
+
case require_html.TAG_ID.TD:
|
|
2394
|
+
case require_html.TAG_ID.TH:
|
|
2395
|
+
p.tmplInsertionModeStack[0] = InsertionMode.IN_ROW;
|
|
2396
|
+
p.insertionMode = InsertionMode.IN_ROW;
|
|
2397
|
+
startTagInRow(p, token);
|
|
2398
|
+
break;
|
|
2399
|
+
default:
|
|
2400
|
+
p.tmplInsertionModeStack[0] = InsertionMode.IN_BODY;
|
|
2401
|
+
p.insertionMode = InsertionMode.IN_BODY;
|
|
2402
|
+
startTagInBody(p, token);
|
|
2403
|
+
}
|
|
2404
|
+
}
|
|
2405
|
+
function endTagInTemplate(p, token) {
|
|
2406
|
+
if (token.tagID === require_html.TAG_ID.TEMPLATE) templateEndTagInHead(p, token);
|
|
2407
|
+
}
|
|
2408
|
+
function eofInTemplate(p, token) {
|
|
2409
|
+
if (p.openElements.tmplCount > 0) {
|
|
2410
|
+
p.openElements.popUntilTagNamePopped(require_html.TAG_ID.TEMPLATE);
|
|
2411
|
+
p.activeFormattingElements.clearToLastMarker();
|
|
2412
|
+
p.tmplInsertionModeStack.shift();
|
|
2413
|
+
p._resetInsertionMode();
|
|
2414
|
+
p.onEof(token);
|
|
2415
|
+
} else stopParsing(p, token);
|
|
2416
|
+
}
|
|
2417
|
+
function startTagAfterBody(p, token) {
|
|
2418
|
+
if (token.tagID === require_html.TAG_ID.HTML) startTagInBody(p, token);
|
|
2419
|
+
else tokenAfterBody(p, token);
|
|
2420
|
+
}
|
|
2421
|
+
function endTagAfterBody(p, token) {
|
|
2422
|
+
var _a;
|
|
2423
|
+
if (token.tagID === require_html.TAG_ID.HTML) {
|
|
2424
|
+
if (!p.fragmentContext) p.insertionMode = InsertionMode.AFTER_AFTER_BODY;
|
|
2425
|
+
if (p.options.sourceCodeLocationInfo && p.openElements.tagIDs[0] === require_html.TAG_ID.HTML) {
|
|
2426
|
+
p._setEndLocation(p.openElements.items[0], token);
|
|
2427
|
+
const bodyElement = p.openElements.items[1];
|
|
2428
|
+
if (bodyElement && !((_a = p.treeAdapter.getNodeSourceCodeLocation(bodyElement)) === null || _a === void 0 ? void 0 : _a.endTag)) p._setEndLocation(bodyElement, token);
|
|
2429
|
+
}
|
|
2430
|
+
} else tokenAfterBody(p, token);
|
|
2431
|
+
}
|
|
2432
|
+
function tokenAfterBody(p, token) {
|
|
2433
|
+
p.insertionMode = InsertionMode.IN_BODY;
|
|
2434
|
+
modeInBody(p, token);
|
|
2435
|
+
}
|
|
2436
|
+
function startTagInFrameset(p, token) {
|
|
2437
|
+
switch (token.tagID) {
|
|
2438
|
+
case require_html.TAG_ID.HTML:
|
|
2439
|
+
startTagInBody(p, token);
|
|
2440
|
+
break;
|
|
2441
|
+
case require_html.TAG_ID.FRAMESET:
|
|
2442
|
+
p._insertElement(token, require_html.NS.HTML);
|
|
2443
|
+
break;
|
|
2444
|
+
case require_html.TAG_ID.FRAME:
|
|
2445
|
+
p._appendElement(token, require_html.NS.HTML);
|
|
2446
|
+
token.ackSelfClosing = true;
|
|
2447
|
+
break;
|
|
2448
|
+
case require_html.TAG_ID.NOFRAMES:
|
|
2449
|
+
startTagInHead(p, token);
|
|
2450
|
+
break;
|
|
2451
|
+
default:
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
function endTagInFrameset(p, token) {
|
|
2455
|
+
if (token.tagID === require_html.TAG_ID.FRAMESET && !p.openElements.isRootHtmlElementCurrent()) {
|
|
2456
|
+
p.openElements.pop();
|
|
2457
|
+
if (!p.fragmentContext && p.openElements.currentTagId !== require_html.TAG_ID.FRAMESET) p.insertionMode = InsertionMode.AFTER_FRAMESET;
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
function startTagAfterFrameset(p, token) {
|
|
2461
|
+
switch (token.tagID) {
|
|
2462
|
+
case require_html.TAG_ID.HTML:
|
|
2463
|
+
startTagInBody(p, token);
|
|
2464
|
+
break;
|
|
2465
|
+
case require_html.TAG_ID.NOFRAMES:
|
|
2466
|
+
startTagInHead(p, token);
|
|
2467
|
+
break;
|
|
2468
|
+
default:
|
|
2469
|
+
}
|
|
2470
|
+
}
|
|
2471
|
+
function endTagAfterFrameset(p, token) {
|
|
2472
|
+
if (token.tagID === require_html.TAG_ID.HTML) p.insertionMode = InsertionMode.AFTER_AFTER_FRAMESET;
|
|
2473
|
+
}
|
|
2474
|
+
function startTagAfterAfterBody(p, token) {
|
|
2475
|
+
if (token.tagID === require_html.TAG_ID.HTML) startTagInBody(p, token);
|
|
2476
|
+
else tokenAfterAfterBody(p, token);
|
|
2477
|
+
}
|
|
2478
|
+
function tokenAfterAfterBody(p, token) {
|
|
2479
|
+
p.insertionMode = InsertionMode.IN_BODY;
|
|
2480
|
+
modeInBody(p, token);
|
|
2481
|
+
}
|
|
2482
|
+
function startTagAfterAfterFrameset(p, token) {
|
|
2483
|
+
switch (token.tagID) {
|
|
2484
|
+
case require_html.TAG_ID.HTML:
|
|
2485
|
+
startTagInBody(p, token);
|
|
2486
|
+
break;
|
|
2487
|
+
case require_html.TAG_ID.NOFRAMES:
|
|
2488
|
+
startTagInHead(p, token);
|
|
2489
|
+
break;
|
|
2490
|
+
default:
|
|
2491
|
+
}
|
|
2492
|
+
}
|
|
2493
|
+
function nullCharacterInForeignContent(p, token) {
|
|
2494
|
+
token.chars = "�";
|
|
2495
|
+
p._insertCharacters(token);
|
|
2496
|
+
}
|
|
2497
|
+
function characterInForeignContent(p, token) {
|
|
2498
|
+
p._insertCharacters(token);
|
|
2499
|
+
p.framesetOk = false;
|
|
2500
|
+
}
|
|
2501
|
+
function popUntilHtmlOrIntegrationPoint(p) {
|
|
2502
|
+
while (p.treeAdapter.getNamespaceURI(p.openElements.current) !== require_html.NS.HTML && p.openElements.currentTagId !== void 0 && !p._isIntegrationPoint(p.openElements.currentTagId, p.openElements.current)) p.openElements.pop();
|
|
2503
|
+
}
|
|
2504
|
+
function startTagInForeignContent(p, token) {
|
|
2505
|
+
if (require_foreign_content.causesExit(token)) {
|
|
2506
|
+
popUntilHtmlOrIntegrationPoint(p);
|
|
2507
|
+
p._startTagOutsideForeignContent(token);
|
|
2508
|
+
} else {
|
|
2509
|
+
const current = p._getAdjustedCurrentElement();
|
|
2510
|
+
const currentNs = p.treeAdapter.getNamespaceURI(current);
|
|
2511
|
+
if (currentNs === require_html.NS.MATHML) require_foreign_content.adjustTokenMathMLAttrs(token);
|
|
2512
|
+
else if (currentNs === require_html.NS.SVG) {
|
|
2513
|
+
require_foreign_content.adjustTokenSVGTagName(token);
|
|
2514
|
+
require_foreign_content.adjustTokenSVGAttrs(token);
|
|
2515
|
+
}
|
|
2516
|
+
require_foreign_content.adjustTokenXMLAttrs(token);
|
|
2517
|
+
if (token.selfClosing) p._appendElement(token, currentNs);
|
|
2518
|
+
else p._insertElement(token, currentNs);
|
|
2519
|
+
token.ackSelfClosing = true;
|
|
2520
|
+
}
|
|
2521
|
+
}
|
|
2522
|
+
function endTagInForeignContent(p, token) {
|
|
2523
|
+
if (token.tagID === require_html.TAG_ID.P || token.tagID === require_html.TAG_ID.BR) {
|
|
2524
|
+
popUntilHtmlOrIntegrationPoint(p);
|
|
2525
|
+
p._endTagOutsideForeignContent(token);
|
|
2526
|
+
return;
|
|
2527
|
+
}
|
|
2528
|
+
for (let i = p.openElements.stackTop; i > 0; i--) {
|
|
2529
|
+
const element = p.openElements.items[i];
|
|
2530
|
+
if (p.treeAdapter.getNamespaceURI(element) === require_html.NS.HTML) {
|
|
2531
|
+
p._endTagOutsideForeignContent(token);
|
|
2532
|
+
break;
|
|
2533
|
+
}
|
|
2534
|
+
const tagName = p.treeAdapter.getTagName(element);
|
|
2535
|
+
if (tagName.toLowerCase() === token.tagName) {
|
|
2536
|
+
token.tagName = tagName;
|
|
2537
|
+
p.openElements.shortenToLength(i);
|
|
2538
|
+
break;
|
|
2539
|
+
}
|
|
2540
|
+
}
|
|
2541
|
+
}
|
|
2542
|
+
|
|
2543
|
+
//#endregion
|
|
2544
|
+
exports.Parser = Parser;
|