@apify/docusaurus-plugin-typedoc-api 4.2.11-0 → 4.2.11-2
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/lib/components/AnchorLink.js.map +1 -0
- package/lib/components/ApiChangelog.js.map +1 -0
- package/lib/components/ApiDataContext.js.map +1 -0
- package/lib/components/ApiIndex.js.map +1 -0
- package/lib/{packages/plugin/src/components → components}/ApiItem.js +6 -1
- package/lib/components/ApiItem.js.map +1 -0
- package/lib/components/ApiItemLayout.js.map +1 -0
- package/lib/components/ApiOptionsLayout.js.map +1 -0
- package/lib/components/ApiPage.js.map +1 -0
- package/lib/components/Breadcrumb.js.map +1 -0
- package/lib/components/Comment.js.map +1 -0
- package/lib/components/CommentBadges.js.map +1 -0
- package/lib/components/DefaultValue.js.map +1 -0
- package/lib/components/Flags.js.map +1 -0
- package/lib/components/Footer.js.map +1 -0
- package/lib/components/Hierarchy.js.map +1 -0
- package/lib/components/Icon.js.map +1 -0
- package/lib/components/Index.js.map +1 -0
- package/lib/components/Markdown.js.map +1 -0
- package/lib/components/Member.js.map +1 -0
- package/lib/components/MemberDeclaration.js.map +1 -0
- package/lib/components/MemberGetterSetter.js.map +1 -0
- package/lib/components/MemberReference.js.map +1 -0
- package/lib/components/MemberSignatureBody.js.map +1 -0
- package/lib/components/MemberSignatureTitle.js.map +1 -0
- package/lib/components/MemberSignatures.js.map +1 -0
- package/lib/components/MemberSources.js.map +1 -0
- package/lib/components/Members.js.map +1 -0
- package/lib/components/MembersGroup.js.map +1 -0
- package/lib/components/Parameter.js.map +1 -0
- package/lib/components/Reflection.js.map +1 -0
- package/lib/components/SourceLink.js.map +1 -0
- package/lib/components/Type.js.map +1 -0
- package/lib/components/TypeAndParent.js.map +1 -0
- package/lib/components/TypeParameters.js.map +1 -0
- package/lib/components/TypeParametersGeneric.js.map +1 -0
- package/lib/components/VersionBanner.js.map +1 -0
- package/lib/hooks/useBreadcrumbs.js.map +1 -0
- package/lib/hooks/useGitRefName.js.map +1 -0
- package/lib/hooks/useMinimalLayout.js.map +1 -0
- package/lib/hooks/useReflection.js.map +1 -0
- package/lib/hooks/useReflectionMap.js.map +1 -0
- package/lib/index.js.map +1 -0
- package/lib/markdownLoader.js.map +1 -0
- package/lib/plugin/data.js.map +1 -0
- package/lib/plugin/python/consts.js.map +1 -0
- package/lib/{packages/plugin/src/plugin → plugin}/python/index.js +4 -1
- package/lib/plugin/python/index.js.map +1 -0
- package/lib/plugin/python/inheritance.js.map +1 -0
- package/lib/plugin/python/packageVersions.js.map +1 -0
- package/lib/plugin/python/transformation.js.map +1 -0
- package/lib/{packages/plugin/src/plugin → plugin}/python/type-parsing/index.js +1 -1
- package/lib/plugin/python/type-parsing/index.js.map +1 -0
- package/lib/plugin/python/utils.js.map +1 -0
- package/lib/plugin/sidebar.js.map +1 -0
- package/lib/plugin/structure/0.23.js.map +1 -0
- package/lib/plugin/url.js.map +1 -0
- package/lib/plugin/version.js.map +1 -0
- package/lib/utils/helpers.js.map +1 -0
- package/lib/utils/hierarchy.js.map +1 -0
- package/lib/utils/icons.js.map +1 -0
- package/lib/utils/links.js.map +1 -0
- package/lib/utils/markdown.js.map +1 -0
- package/lib/{packages/plugin/src/utils → utils}/reexports.js +8 -3
- package/lib/utils/reexports.js.map +1 -0
- package/lib/utils/visibility.js.map +1 -0
- package/package.json +4 -2
- package/src/components/ApiItem.tsx +25 -12
- package/src/plugin/python/index.ts +6 -2
- package/src/plugin/python/type-parsing/index.ts +1 -1
- package/src/utils/reexports.ts +7 -1
- package/lib/_virtual/_commonjsHelpers.js +0 -44
- package/lib/_virtual/_commonjsHelpers.js.map +0 -1
- package/lib/node_modules/boolbase/index.js +0 -18
- package/lib/node_modules/boolbase/index.js.map +0 -1
- package/lib/node_modules/cheerio/lib/esm/api/attributes.js +0 -568
- package/lib/node_modules/cheerio/lib/esm/api/attributes.js.map +0 -1
- package/lib/node_modules/cheerio/lib/esm/api/css.js +0 -113
- package/lib/node_modules/cheerio/lib/esm/api/css.js.map +0 -1
- package/lib/node_modules/cheerio/lib/esm/api/forms.js +0 -92
- package/lib/node_modules/cheerio/lib/esm/api/forms.js.map +0 -1
- package/lib/node_modules/cheerio/lib/esm/api/manipulation.js +0 -807
- package/lib/node_modules/cheerio/lib/esm/api/manipulation.js.map +0 -1
- package/lib/node_modules/cheerio/lib/esm/api/traversing.js +0 -842
- package/lib/node_modules/cheerio/lib/esm/api/traversing.js.map +0 -1
- package/lib/node_modules/cheerio/lib/esm/cheerio.js +0 -41
- package/lib/node_modules/cheerio/lib/esm/cheerio.js.map +0 -1
- package/lib/node_modules/cheerio/lib/esm/index.js +0 -112
- package/lib/node_modules/cheerio/lib/esm/index.js.map +0 -1
- package/lib/node_modules/cheerio/lib/esm/load.js +0 -110
- package/lib/node_modules/cheerio/lib/esm/load.js.map +0 -1
- package/lib/node_modules/cheerio/lib/esm/options.js +0 -32
- package/lib/node_modules/cheerio/lib/esm/options.js.map +0 -1
- package/lib/node_modules/cheerio/lib/esm/parse.js +0 -78
- package/lib/node_modules/cheerio/lib/esm/parse.js.map +0 -1
- package/lib/node_modules/cheerio/lib/esm/parsers/parse5-adapter.js +0 -57
- package/lib/node_modules/cheerio/lib/esm/parsers/parse5-adapter.js.map +0 -1
- package/lib/node_modules/cheerio/lib/esm/static.js +0 -191
- package/lib/node_modules/cheerio/lib/esm/static.js.map +0 -1
- package/lib/node_modules/cheerio/lib/esm/utils.js +0 -105
- package/lib/node_modules/cheerio/lib/esm/utils.js.map +0 -1
- package/lib/node_modules/cheerio/node_modules/htmlparser2/lib/esm/Parser.js +0 -381
- package/lib/node_modules/cheerio/node_modules/htmlparser2/lib/esm/Parser.js.map +0 -1
- package/lib/node_modules/cheerio/node_modules/htmlparser2/lib/esm/Tokenizer.js +0 -888
- package/lib/node_modules/cheerio/node_modules/htmlparser2/lib/esm/Tokenizer.js.map +0 -1
- package/lib/node_modules/cheerio/node_modules/htmlparser2/lib/esm/index.js +0 -69
- package/lib/node_modules/cheerio/node_modules/htmlparser2/lib/esm/index.js.map +0 -1
- package/lib/node_modules/cheerio-select/lib/esm/helpers.js +0 -22
- package/lib/node_modules/cheerio-select/lib/esm/helpers.js.map +0 -1
- package/lib/node_modules/cheerio-select/lib/esm/index.js +0 -252
- package/lib/node_modules/cheerio-select/lib/esm/index.js.map +0 -1
- package/lib/node_modules/cheerio-select/lib/esm/positionals.js +0 -37
- package/lib/node_modules/cheerio-select/lib/esm/positionals.js.map +0 -1
- package/lib/node_modules/css-select/lib/esm/attributes.js +0 -155
- package/lib/node_modules/css-select/lib/esm/attributes.js.map +0 -1
- package/lib/node_modules/css-select/lib/esm/compile.js +0 -118
- package/lib/node_modules/css-select/lib/esm/compile.js.map +0 -1
- package/lib/node_modules/css-select/lib/esm/general.js +0 -155
- package/lib/node_modules/css-select/lib/esm/general.js.map +0 -1
- package/lib/node_modules/css-select/lib/esm/index.js +0 -115
- package/lib/node_modules/css-select/lib/esm/index.js.map +0 -1
- package/lib/node_modules/css-select/lib/esm/pseudo-selectors/aliases.js +0 -38
- package/lib/node_modules/css-select/lib/esm/pseudo-selectors/aliases.js.map +0 -1
- package/lib/node_modules/css-select/lib/esm/pseudo-selectors/filters.js +0 -151
- package/lib/node_modules/css-select/lib/esm/pseudo-selectors/filters.js.map +0 -1
- package/lib/node_modules/css-select/lib/esm/pseudo-selectors/index.js +0 -47
- package/lib/node_modules/css-select/lib/esm/pseudo-selectors/index.js.map +0 -1
- package/lib/node_modules/css-select/lib/esm/pseudo-selectors/pseudos.js +0 -88
- package/lib/node_modules/css-select/lib/esm/pseudo-selectors/pseudos.js.map +0 -1
- package/lib/node_modules/css-select/lib/esm/pseudo-selectors/subselects.js +0 -85
- package/lib/node_modules/css-select/lib/esm/pseudo-selectors/subselects.js.map +0 -1
- package/lib/node_modules/css-select/lib/esm/sort.js +0 -70
- package/lib/node_modules/css-select/lib/esm/sort.js.map +0 -1
- package/lib/node_modules/css-what/lib/es/index.js +0 -18
- package/lib/node_modules/css-what/lib/es/index.js.map +0 -1
- package/lib/node_modules/css-what/lib/es/parse.js +0 -397
- package/lib/node_modules/css-what/lib/es/parse.js.map +0 -1
- package/lib/node_modules/css-what/lib/es/stringify.js +0 -95
- package/lib/node_modules/css-what/lib/es/stringify.js.map +0 -1
- package/lib/node_modules/css-what/lib/es/types.js +0 -43
- package/lib/node_modules/css-what/lib/es/types.js.map +0 -1
- package/lib/node_modules/dom-serializer/lib/esm/foreignNames.js +0 -7
- package/lib/node_modules/dom-serializer/lib/esm/foreignNames.js.map +0 -1
- package/lib/node_modules/dom-serializer/lib/esm/index.js +0 -146
- package/lib/node_modules/dom-serializer/lib/esm/index.js.map +0 -1
- package/lib/node_modules/domelementtype/lib/esm/index.js +0 -62
- package/lib/node_modules/domelementtype/lib/esm/index.js.map +0 -1
- package/lib/node_modules/domhandler/lib/esm/index.js +0 -166
- package/lib/node_modules/domhandler/lib/esm/index.js.map +0 -1
- package/lib/node_modules/domhandler/lib/esm/node.js +0 -352
- package/lib/node_modules/domhandler/lib/esm/node.js.map +0 -1
- package/lib/node_modules/domutils/lib/esm/feeds.js +0 -176
- package/lib/node_modules/domutils/lib/esm/feeds.js.map +0 -1
- package/lib/node_modules/domutils/lib/esm/helpers.js +0 -142
- package/lib/node_modules/domutils/lib/esm/helpers.js.map +0 -1
- package/lib/node_modules/domutils/lib/esm/index.js +0 -56
- package/lib/node_modules/domutils/lib/esm/index.js.map +0 -1
- package/lib/node_modules/domutils/lib/esm/legacy.js +0 -144
- package/lib/node_modules/domutils/lib/esm/legacy.js.map +0 -1
- package/lib/node_modules/domutils/lib/esm/manipulation.js +0 -137
- package/lib/node_modules/domutils/lib/esm/manipulation.js.map +0 -1
- package/lib/node_modules/domutils/lib/esm/querying.js +0 -149
- package/lib/node_modules/domutils/lib/esm/querying.js.map +0 -1
- package/lib/node_modules/domutils/lib/esm/stringify.js +0 -80
- package/lib/node_modules/domutils/lib/esm/stringify.js.map +0 -1
- package/lib/node_modules/domutils/lib/esm/traversal.js +0 -128
- package/lib/node_modules/domutils/lib/esm/traversal.js.map +0 -1
- package/lib/node_modules/entities/lib/esm/decode.js +0 -495
- package/lib/node_modules/entities/lib/esm/decode.js.map +0 -1
- package/lib/node_modules/entities/lib/esm/decode_codepoint.js +0 -52
- package/lib/node_modules/entities/lib/esm/decode_codepoint.js.map +0 -1
- package/lib/node_modules/entities/lib/esm/encode.js +0 -68
- package/lib/node_modules/entities/lib/esm/encode.js.map +0 -1
- package/lib/node_modules/entities/lib/esm/escape.js +0 -103
- package/lib/node_modules/entities/lib/esm/escape.js.map +0 -1
- package/lib/node_modules/entities/lib/esm/generated/decode-data-html.js +0 -8
- package/lib/node_modules/entities/lib/esm/generated/decode-data-html.js.map +0 -1
- package/lib/node_modules/entities/lib/esm/generated/decode-data-xml.js +0 -8
- package/lib/node_modules/entities/lib/esm/generated/decode-data-xml.js.map +0 -1
- package/lib/node_modules/entities/lib/esm/generated/encode-html.js +0 -264
- package/lib/node_modules/entities/lib/esm/generated/encode-html.js.map +0 -1
- package/lib/node_modules/entities/lib/esm/index.js +0 -122
- package/lib/node_modules/entities/lib/esm/index.js.map +0 -1
- package/lib/node_modules/nth-check/lib/esm/compile.js +0 -111
- package/lib/node_modules/nth-check/lib/esm/compile.js.map +0 -1
- package/lib/node_modules/nth-check/lib/esm/index.js +0 -73
- package/lib/node_modules/nth-check/lib/esm/index.js.map +0 -1
- package/lib/node_modules/nth-check/lib/esm/parse.js +0 -71
- package/lib/node_modules/nth-check/lib/esm/parse.js.map +0 -1
- package/lib/node_modules/parse5/dist/common/doctype.js +0 -49
- package/lib/node_modules/parse5/dist/common/doctype.js.map +0 -1
- package/lib/node_modules/parse5/dist/common/error-codes.js +0 -66
- package/lib/node_modules/parse5/dist/common/error-codes.js.map +0 -1
- package/lib/node_modules/parse5/dist/common/foreign-content.js +0 -134
- package/lib/node_modules/parse5/dist/common/foreign-content.js.map +0 -1
- package/lib/node_modules/parse5/dist/common/html.js +0 -316
- package/lib/node_modules/parse5/dist/common/html.js.map +0 -1
- package/lib/node_modules/parse5/dist/common/token.js +0 -24
- package/lib/node_modules/parse5/dist/common/token.js.map +0 -1
- package/lib/node_modules/parse5/dist/common/unicode.js +0 -72
- package/lib/node_modules/parse5/dist/common/unicode.js.map +0 -1
- package/lib/node_modules/parse5/dist/index.js +0 -58
- package/lib/node_modules/parse5/dist/index.js.map +0 -1
- package/lib/node_modules/parse5/dist/parser/formatting-element-list.js +0 -115
- package/lib/node_modules/parse5/dist/parser/formatting-element-list.js.map +0 -1
- package/lib/node_modules/parse5/dist/parser/index.js +0 -3387
- package/lib/node_modules/parse5/dist/parser/index.js.map +0 -1
- package/lib/node_modules/parse5/dist/parser/open-element-stack.js +0 -286
- package/lib/node_modules/parse5/dist/parser/open-element-stack.js.map +0 -1
- package/lib/node_modules/parse5/dist/serializer/index.js +0 -160
- package/lib/node_modules/parse5/dist/serializer/index.js.map +0 -1
- package/lib/node_modules/parse5/dist/tokenizer/index.js +0 -3142
- package/lib/node_modules/parse5/dist/tokenizer/index.js.map +0 -1
- package/lib/node_modules/parse5/dist/tokenizer/preprocessor.js +0 -195
- package/lib/node_modules/parse5/dist/tokenizer/preprocessor.js.map +0 -1
- package/lib/node_modules/parse5/dist/tree-adapters/default.js +0 -180
- package/lib/node_modules/parse5/dist/tree-adapters/default.js.map +0 -1
- package/lib/node_modules/parse5-htmlparser2-tree-adapter/dist/index.js +0 -218
- package/lib/node_modules/parse5-htmlparser2-tree-adapter/dist/index.js.map +0 -1
- package/lib/packages/plugin/src/components/AnchorLink.js.map +0 -1
- package/lib/packages/plugin/src/components/ApiChangelog.js.map +0 -1
- package/lib/packages/plugin/src/components/ApiDataContext.js.map +0 -1
- package/lib/packages/plugin/src/components/ApiIndex.js.map +0 -1
- package/lib/packages/plugin/src/components/ApiItem.js.map +0 -1
- package/lib/packages/plugin/src/components/ApiItemLayout.js.map +0 -1
- package/lib/packages/plugin/src/components/ApiOptionsLayout.js.map +0 -1
- package/lib/packages/plugin/src/components/ApiPage.js.map +0 -1
- package/lib/packages/plugin/src/components/Breadcrumb.js.map +0 -1
- package/lib/packages/plugin/src/components/Comment.js.map +0 -1
- package/lib/packages/plugin/src/components/CommentBadges.js.map +0 -1
- package/lib/packages/plugin/src/components/DefaultValue.js.map +0 -1
- package/lib/packages/plugin/src/components/Flags.js.map +0 -1
- package/lib/packages/plugin/src/components/Footer.js.map +0 -1
- package/lib/packages/plugin/src/components/Hierarchy.js.map +0 -1
- package/lib/packages/plugin/src/components/Icon.js.map +0 -1
- package/lib/packages/plugin/src/components/Index.js.map +0 -1
- package/lib/packages/plugin/src/components/Markdown.js.map +0 -1
- package/lib/packages/plugin/src/components/Member.js.map +0 -1
- package/lib/packages/plugin/src/components/MemberDeclaration.js.map +0 -1
- package/lib/packages/plugin/src/components/MemberGetterSetter.js.map +0 -1
- package/lib/packages/plugin/src/components/MemberReference.js.map +0 -1
- package/lib/packages/plugin/src/components/MemberSignatureBody.js.map +0 -1
- package/lib/packages/plugin/src/components/MemberSignatureTitle.js.map +0 -1
- package/lib/packages/plugin/src/components/MemberSignatures.js.map +0 -1
- package/lib/packages/plugin/src/components/MemberSources.js.map +0 -1
- package/lib/packages/plugin/src/components/Members.js.map +0 -1
- package/lib/packages/plugin/src/components/MembersGroup.js.map +0 -1
- package/lib/packages/plugin/src/components/Parameter.js.map +0 -1
- package/lib/packages/plugin/src/components/Reflection.js.map +0 -1
- package/lib/packages/plugin/src/components/SourceLink.js.map +0 -1
- package/lib/packages/plugin/src/components/Type.js.map +0 -1
- package/lib/packages/plugin/src/components/TypeAndParent.js.map +0 -1
- package/lib/packages/plugin/src/components/TypeParameters.js.map +0 -1
- package/lib/packages/plugin/src/components/TypeParametersGeneric.js.map +0 -1
- package/lib/packages/plugin/src/components/VersionBanner.js.map +0 -1
- package/lib/packages/plugin/src/hooks/useBreadcrumbs.js.map +0 -1
- package/lib/packages/plugin/src/hooks/useGitRefName.js.map +0 -1
- package/lib/packages/plugin/src/hooks/useMinimalLayout.js.map +0 -1
- package/lib/packages/plugin/src/hooks/useReflection.js.map +0 -1
- package/lib/packages/plugin/src/hooks/useReflectionMap.js.map +0 -1
- package/lib/packages/plugin/src/index.js.map +0 -1
- package/lib/packages/plugin/src/markdownLoader.js.map +0 -1
- package/lib/packages/plugin/src/plugin/data.js.map +0 -1
- package/lib/packages/plugin/src/plugin/python/consts.js.map +0 -1
- package/lib/packages/plugin/src/plugin/python/index.js.map +0 -1
- package/lib/packages/plugin/src/plugin/python/inheritance.js.map +0 -1
- package/lib/packages/plugin/src/plugin/python/packageVersions.js.map +0 -1
- package/lib/packages/plugin/src/plugin/python/transformation.js.map +0 -1
- package/lib/packages/plugin/src/plugin/python/type-parsing/index.js.map +0 -1
- package/lib/packages/plugin/src/plugin/python/utils.js.map +0 -1
- package/lib/packages/plugin/src/plugin/sidebar.js.map +0 -1
- package/lib/packages/plugin/src/plugin/structure/0.23.js.map +0 -1
- package/lib/packages/plugin/src/plugin/url.js.map +0 -1
- package/lib/packages/plugin/src/plugin/version.js.map +0 -1
- package/lib/packages/plugin/src/types.js +0 -2
- package/lib/packages/plugin/src/types.js.map +0 -1
- package/lib/packages/plugin/src/utils/helpers.js.map +0 -1
- package/lib/packages/plugin/src/utils/hierarchy.js.map +0 -1
- package/lib/packages/plugin/src/utils/icons.js.map +0 -1
- package/lib/packages/plugin/src/utils/links.js.map +0 -1
- package/lib/packages/plugin/src/utils/markdown.js.map +0 -1
- package/lib/packages/plugin/src/utils/reexports.js.map +0 -1
- package/lib/packages/plugin/src/utils/visibility.js.map +0 -1
- /package/lib/{packages/plugin/src/components → components}/AnchorLink.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/ApiChangelog.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/ApiDataContext.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/ApiIndex.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/ApiItemLayout.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/ApiOptionsLayout.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/ApiPage.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/Breadcrumb.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/Comment.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/CommentBadges.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/DefaultValue.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/Flags.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/Footer.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/Hierarchy.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/Icon.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/Index.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/Markdown.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/Member.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/MemberDeclaration.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/MemberGetterSetter.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/MemberReference.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/MemberSignatureBody.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/MemberSignatureTitle.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/MemberSignatures.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/MemberSources.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/Members.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/MembersGroup.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/Parameter.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/Reflection.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/SourceLink.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/Type.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/TypeAndParent.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/TypeParameters.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/TypeParametersGeneric.js +0 -0
- /package/lib/{packages/plugin/src/components → components}/VersionBanner.js +0 -0
- /package/lib/{packages/plugin/src/hooks → hooks}/useBreadcrumbs.js +0 -0
- /package/lib/{packages/plugin/src/hooks → hooks}/useGitRefName.js +0 -0
- /package/lib/{packages/plugin/src/hooks → hooks}/useMinimalLayout.js +0 -0
- /package/lib/{packages/plugin/src/hooks → hooks}/useReflection.js +0 -0
- /package/lib/{packages/plugin/src/hooks → hooks}/useReflectionMap.js +0 -0
- /package/lib/{packages/plugin/src/index.js → index.js} +0 -0
- /package/lib/{packages/plugin/src/markdownLoader.js → markdownLoader.js} +0 -0
- /package/lib/{packages/plugin/src/plugin → plugin}/data.js +0 -0
- /package/lib/{packages/plugin/src/plugin → plugin}/python/consts.js +0 -0
- /package/lib/{packages/plugin/src/plugin → plugin}/python/inheritance.js +0 -0
- /package/lib/{packages/plugin/src/plugin → plugin}/python/packageVersions.js +0 -0
- /package/lib/{packages/plugin/src/plugin → plugin}/python/transformation.js +0 -0
- /package/lib/{node_modules/cheerio/lib/esm → plugin/python}/types.js +0 -0
- /package/lib/{node_modules/cheerio/lib/esm → plugin/python}/types.js.map +0 -0
- /package/lib/{packages/plugin/src/plugin → plugin}/python/utils.js +0 -0
- /package/lib/{packages/plugin/src/plugin → plugin}/sidebar.js +0 -0
- /package/lib/{packages/plugin/src/plugin → plugin}/structure/0.23.js +0 -0
- /package/lib/{packages/plugin/src/plugin → plugin}/url.js +0 -0
- /package/lib/{packages/plugin/src/plugin → plugin}/version.js +0 -0
- /package/lib/{packages/plugin/src/plugin/python/types.js → types.js} +0 -0
- /package/lib/{packages/plugin/src/plugin/python/types.js.map → types.js.map} +0 -0
- /package/lib/{packages/plugin/src/utils → utils}/helpers.js +0 -0
- /package/lib/{packages/plugin/src/utils → utils}/hierarchy.js +0 -0
- /package/lib/{packages/plugin/src/utils → utils}/icons.js +0 -0
- /package/lib/{packages/plugin/src/utils → utils}/links.js +0 -0
- /package/lib/{packages/plugin/src/utils → utils}/markdown.js +0 -0
- /package/lib/{packages/plugin/src/utils → utils}/visibility.js +0 -0
- /package/{src/plugin/python → python-scripts}/docspec-gen/__init__.py +0 -0
- /package/{src/plugin/python → python-scripts}/docspec-gen/generate_ast.py +0 -0
- /package/{src/plugin/python → python-scripts}/docspec-gen/google_docstring_processor.py +0 -0
- /package/{src/plugin/python → python-scripts}/type-parsing/parse_types.py +0 -0
|
@@ -1,3387 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
6
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
7
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
-
const index = require('../tokenizer/index.js');
|
|
9
|
-
const openElementStack = require('./open-element-stack.js');
|
|
10
|
-
const formattingElementList = require('./formatting-element-list.js');
|
|
11
|
-
const _default = require('../tree-adapters/default.js');
|
|
12
|
-
const doctype = require('../common/doctype.js');
|
|
13
|
-
const foreignContent = require('../common/foreign-content.js');
|
|
14
|
-
const errorCodes = require('../common/error-codes.js');
|
|
15
|
-
const unicode = require('../common/unicode.js');
|
|
16
|
-
const html = require('../common/html.js');
|
|
17
|
-
const token = require('../common/token.js');
|
|
18
|
-
|
|
19
|
-
//Misc constants
|
|
20
|
-
const HIDDEN_INPUT_TYPE = 'hidden';
|
|
21
|
-
//Adoption agency loops iteration count
|
|
22
|
-
const AA_OUTER_LOOP_ITER = 8;
|
|
23
|
-
const AA_INNER_LOOP_ITER = 3;
|
|
24
|
-
//Insertion modes
|
|
25
|
-
var InsertionMode;
|
|
26
|
-
(function (InsertionMode) {
|
|
27
|
-
InsertionMode[InsertionMode["INITIAL"] = 0] = "INITIAL";
|
|
28
|
-
InsertionMode[InsertionMode["BEFORE_HTML"] = 1] = "BEFORE_HTML";
|
|
29
|
-
InsertionMode[InsertionMode["BEFORE_HEAD"] = 2] = "BEFORE_HEAD";
|
|
30
|
-
InsertionMode[InsertionMode["IN_HEAD"] = 3] = "IN_HEAD";
|
|
31
|
-
InsertionMode[InsertionMode["IN_HEAD_NO_SCRIPT"] = 4] = "IN_HEAD_NO_SCRIPT";
|
|
32
|
-
InsertionMode[InsertionMode["AFTER_HEAD"] = 5] = "AFTER_HEAD";
|
|
33
|
-
InsertionMode[InsertionMode["IN_BODY"] = 6] = "IN_BODY";
|
|
34
|
-
InsertionMode[InsertionMode["TEXT"] = 7] = "TEXT";
|
|
35
|
-
InsertionMode[InsertionMode["IN_TABLE"] = 8] = "IN_TABLE";
|
|
36
|
-
InsertionMode[InsertionMode["IN_TABLE_TEXT"] = 9] = "IN_TABLE_TEXT";
|
|
37
|
-
InsertionMode[InsertionMode["IN_CAPTION"] = 10] = "IN_CAPTION";
|
|
38
|
-
InsertionMode[InsertionMode["IN_COLUMN_GROUP"] = 11] = "IN_COLUMN_GROUP";
|
|
39
|
-
InsertionMode[InsertionMode["IN_TABLE_BODY"] = 12] = "IN_TABLE_BODY";
|
|
40
|
-
InsertionMode[InsertionMode["IN_ROW"] = 13] = "IN_ROW";
|
|
41
|
-
InsertionMode[InsertionMode["IN_CELL"] = 14] = "IN_CELL";
|
|
42
|
-
InsertionMode[InsertionMode["IN_SELECT"] = 15] = "IN_SELECT";
|
|
43
|
-
InsertionMode[InsertionMode["IN_SELECT_IN_TABLE"] = 16] = "IN_SELECT_IN_TABLE";
|
|
44
|
-
InsertionMode[InsertionMode["IN_TEMPLATE"] = 17] = "IN_TEMPLATE";
|
|
45
|
-
InsertionMode[InsertionMode["AFTER_BODY"] = 18] = "AFTER_BODY";
|
|
46
|
-
InsertionMode[InsertionMode["IN_FRAMESET"] = 19] = "IN_FRAMESET";
|
|
47
|
-
InsertionMode[InsertionMode["AFTER_FRAMESET"] = 20] = "AFTER_FRAMESET";
|
|
48
|
-
InsertionMode[InsertionMode["AFTER_AFTER_BODY"] = 21] = "AFTER_AFTER_BODY";
|
|
49
|
-
InsertionMode[InsertionMode["AFTER_AFTER_FRAMESET"] = 22] = "AFTER_AFTER_FRAMESET";
|
|
50
|
-
})(InsertionMode || (InsertionMode = {}));
|
|
51
|
-
const BASE_LOC = {
|
|
52
|
-
startLine: -1,
|
|
53
|
-
startCol: -1,
|
|
54
|
-
startOffset: -1,
|
|
55
|
-
endLine: -1,
|
|
56
|
-
endCol: -1,
|
|
57
|
-
endOffset: -1
|
|
58
|
-
};
|
|
59
|
-
const TABLE_STRUCTURE_TAGS = new Set([html.TAG_ID.TABLE, html.TAG_ID.TBODY, html.TAG_ID.TFOOT, html.TAG_ID.THEAD, html.TAG_ID.TR]);
|
|
60
|
-
const defaultParserOptions = {
|
|
61
|
-
scriptingEnabled: true,
|
|
62
|
-
sourceCodeLocationInfo: false,
|
|
63
|
-
treeAdapter: _default.defaultTreeAdapter,
|
|
64
|
-
onParseError: null
|
|
65
|
-
};
|
|
66
|
-
//Parser
|
|
67
|
-
class Parser {
|
|
68
|
-
constructor(options, document, fragmentContext = null, scriptHandler = null) {
|
|
69
|
-
this.fragmentContext = fragmentContext;
|
|
70
|
-
this.scriptHandler = scriptHandler;
|
|
71
|
-
this.currentToken = null;
|
|
72
|
-
this.stopped = false;
|
|
73
|
-
this.insertionMode = InsertionMode.INITIAL;
|
|
74
|
-
this.originalInsertionMode = InsertionMode.INITIAL;
|
|
75
|
-
this.headElement = null;
|
|
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
|
-
this.tmplInsertionModeStack = [];
|
|
84
|
-
this.pendingCharacterTokens = [];
|
|
85
|
-
this.hasNonWhitespacePendingCharacterToken = false;
|
|
86
|
-
this.framesetOk = true;
|
|
87
|
-
this.skipNextNewLine = false;
|
|
88
|
-
this.fosterParentingEnabled = false;
|
|
89
|
-
this.options = _objectSpread(_objectSpread({}, defaultParserOptions), options);
|
|
90
|
-
this.treeAdapter = this.options.treeAdapter;
|
|
91
|
-
this.onParseError = this.options.onParseError;
|
|
92
|
-
// Always enable location info if we report parse errors.
|
|
93
|
-
if (this.onParseError) {
|
|
94
|
-
this.options.sourceCodeLocationInfo = true;
|
|
95
|
-
}
|
|
96
|
-
this.document = document !== null && document !== void 0 ? document : this.treeAdapter.createDocument();
|
|
97
|
-
this.tokenizer = new index.Tokenizer(this.options, this);
|
|
98
|
-
this.activeFormattingElements = new formattingElementList.FormattingElementList(this.treeAdapter);
|
|
99
|
-
this.fragmentContextID = fragmentContext ? html.getTagID(this.treeAdapter.getTagName(fragmentContext)) : html.TAG_ID.UNKNOWN;
|
|
100
|
-
this._setContextModes(fragmentContext !== null && fragmentContext !== void 0 ? fragmentContext : this.document, this.fragmentContextID);
|
|
101
|
-
this.openElements = new openElementStack.OpenElementStack(this.document, this.treeAdapter, this);
|
|
102
|
-
}
|
|
103
|
-
// API
|
|
104
|
-
static parse(html, options) {
|
|
105
|
-
const parser = new this(options);
|
|
106
|
-
parser.tokenizer.write(html, true);
|
|
107
|
-
return parser.document;
|
|
108
|
-
}
|
|
109
|
-
static getFragmentParser(fragmentContext, options) {
|
|
110
|
-
const opts = _objectSpread(_objectSpread({}, defaultParserOptions), options);
|
|
111
|
-
//NOTE: use a <template> element as the fragment context if no context element was provided,
|
|
112
|
-
//so we will parse in a "forgiving" manner
|
|
113
|
-
fragmentContext !== null && fragmentContext !== void 0 ? fragmentContext : fragmentContext = opts.treeAdapter.createElement(html.TAG_NAMES.TEMPLATE, html.NS.HTML, []);
|
|
114
|
-
//NOTE: create a fake element which will be used as the `document` for fragment parsing.
|
|
115
|
-
//This is important for jsdom, where a new `document` cannot be created. This led to
|
|
116
|
-
//fragment parsing messing with the main `document`.
|
|
117
|
-
const documentMock = opts.treeAdapter.createElement('documentmock', html.NS.HTML, []);
|
|
118
|
-
const parser = new this(opts, documentMock, fragmentContext);
|
|
119
|
-
if (parser.fragmentContextID === html.TAG_ID.TEMPLATE) {
|
|
120
|
-
parser.tmplInsertionModeStack.unshift(InsertionMode.IN_TEMPLATE);
|
|
121
|
-
}
|
|
122
|
-
parser._initTokenizerForFragmentParsing();
|
|
123
|
-
parser._insertFakeRootElement();
|
|
124
|
-
parser._resetInsertionMode();
|
|
125
|
-
parser._findFormInFragmentContext();
|
|
126
|
-
return parser;
|
|
127
|
-
}
|
|
128
|
-
getFragment() {
|
|
129
|
-
const rootElement = this.treeAdapter.getFirstChild(this.document);
|
|
130
|
-
const fragment = this.treeAdapter.createDocumentFragment();
|
|
131
|
-
this._adoptNodes(rootElement, fragment);
|
|
132
|
-
return fragment;
|
|
133
|
-
}
|
|
134
|
-
//Errors
|
|
135
|
-
_err(token, code, beforeToken) {
|
|
136
|
-
var _a;
|
|
137
|
-
if (!this.onParseError) return;
|
|
138
|
-
const loc = (_a = token.location) !== null && _a !== void 0 ? _a : BASE_LOC;
|
|
139
|
-
const err = {
|
|
140
|
-
code,
|
|
141
|
-
startLine: loc.startLine,
|
|
142
|
-
startCol: loc.startCol,
|
|
143
|
-
startOffset: loc.startOffset,
|
|
144
|
-
endLine: beforeToken ? loc.startLine : loc.endLine,
|
|
145
|
-
endCol: beforeToken ? loc.startCol : loc.endCol,
|
|
146
|
-
endOffset: beforeToken ? loc.startOffset : loc.endOffset
|
|
147
|
-
};
|
|
148
|
-
this.onParseError(err);
|
|
149
|
-
}
|
|
150
|
-
//Stack events
|
|
151
|
-
onItemPush(node, tid, isTop) {
|
|
152
|
-
var _a, _b;
|
|
153
|
-
(_b = (_a = this.treeAdapter).onItemPush) === null || _b === void 0 ? void 0 : _b.call(_a, node);
|
|
154
|
-
if (isTop && this.openElements.stackTop > 0) this._setContextModes(node, tid);
|
|
155
|
-
}
|
|
156
|
-
onItemPop(node, isTop) {
|
|
157
|
-
var _a, _b;
|
|
158
|
-
if (this.options.sourceCodeLocationInfo) {
|
|
159
|
-
this._setEndLocation(node, this.currentToken);
|
|
160
|
-
}
|
|
161
|
-
(_b = (_a = this.treeAdapter).onItemPop) === null || _b === void 0 ? void 0 : _b.call(_a, node, this.openElements.current);
|
|
162
|
-
if (isTop) {
|
|
163
|
-
let current;
|
|
164
|
-
let currentTagId;
|
|
165
|
-
if (this.openElements.stackTop === 0 && this.fragmentContext) {
|
|
166
|
-
current = this.fragmentContext;
|
|
167
|
-
currentTagId = this.fragmentContextID;
|
|
168
|
-
} else {
|
|
169
|
-
var _this$openElements = this.openElements;
|
|
170
|
-
current = _this$openElements.current;
|
|
171
|
-
currentTagId = _this$openElements.currentTagId;
|
|
172
|
-
}
|
|
173
|
-
this._setContextModes(current, currentTagId);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
_setContextModes(current, tid) {
|
|
177
|
-
const isHTML = current === this.document || this.treeAdapter.getNamespaceURI(current) === html.NS.HTML;
|
|
178
|
-
this.currentNotInHTML = !isHTML;
|
|
179
|
-
this.tokenizer.inForeignNode = !isHTML && !this._isIntegrationPoint(tid, current);
|
|
180
|
-
}
|
|
181
|
-
_switchToTextParsing(currentToken, nextTokenizerState) {
|
|
182
|
-
this._insertElement(currentToken, html.NS.HTML);
|
|
183
|
-
this.tokenizer.state = nextTokenizerState;
|
|
184
|
-
this.originalInsertionMode = this.insertionMode;
|
|
185
|
-
this.insertionMode = InsertionMode.TEXT;
|
|
186
|
-
}
|
|
187
|
-
switchToPlaintextParsing() {
|
|
188
|
-
this.insertionMode = InsertionMode.TEXT;
|
|
189
|
-
this.originalInsertionMode = InsertionMode.IN_BODY;
|
|
190
|
-
this.tokenizer.state = index.TokenizerMode.PLAINTEXT;
|
|
191
|
-
}
|
|
192
|
-
//Fragment parsing
|
|
193
|
-
_getAdjustedCurrentElement() {
|
|
194
|
-
return this.openElements.stackTop === 0 && this.fragmentContext ? this.fragmentContext : this.openElements.current;
|
|
195
|
-
}
|
|
196
|
-
_findFormInFragmentContext() {
|
|
197
|
-
let node = this.fragmentContext;
|
|
198
|
-
while (node) {
|
|
199
|
-
if (this.treeAdapter.getTagName(node) === html.TAG_NAMES.FORM) {
|
|
200
|
-
this.formElement = node;
|
|
201
|
-
break;
|
|
202
|
-
}
|
|
203
|
-
node = this.treeAdapter.getParentNode(node);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
_initTokenizerForFragmentParsing() {
|
|
207
|
-
if (!this.fragmentContext || this.treeAdapter.getNamespaceURI(this.fragmentContext) !== html.NS.HTML) {
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
switch (this.fragmentContextID) {
|
|
211
|
-
case html.TAG_ID.TITLE:
|
|
212
|
-
case html.TAG_ID.TEXTAREA:
|
|
213
|
-
{
|
|
214
|
-
this.tokenizer.state = index.TokenizerMode.RCDATA;
|
|
215
|
-
break;
|
|
216
|
-
}
|
|
217
|
-
case html.TAG_ID.STYLE:
|
|
218
|
-
case html.TAG_ID.XMP:
|
|
219
|
-
case html.TAG_ID.IFRAME:
|
|
220
|
-
case html.TAG_ID.NOEMBED:
|
|
221
|
-
case html.TAG_ID.NOFRAMES:
|
|
222
|
-
case html.TAG_ID.NOSCRIPT:
|
|
223
|
-
{
|
|
224
|
-
this.tokenizer.state = index.TokenizerMode.RAWTEXT;
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
case html.TAG_ID.SCRIPT:
|
|
228
|
-
{
|
|
229
|
-
this.tokenizer.state = index.TokenizerMode.SCRIPT_DATA;
|
|
230
|
-
break;
|
|
231
|
-
}
|
|
232
|
-
case html.TAG_ID.PLAINTEXT:
|
|
233
|
-
{
|
|
234
|
-
this.tokenizer.state = index.TokenizerMode.PLAINTEXT;
|
|
235
|
-
break;
|
|
236
|
-
}
|
|
237
|
-
default:
|
|
238
|
-
// Do nothing
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
//Tree mutation
|
|
242
|
-
_setDocumentType(token) {
|
|
243
|
-
const name = token.name || '';
|
|
244
|
-
const publicId = token.publicId || '';
|
|
245
|
-
const systemId = token.systemId || '';
|
|
246
|
-
this.treeAdapter.setDocumentType(this.document, name, publicId, systemId);
|
|
247
|
-
if (token.location) {
|
|
248
|
-
const documentChildren = this.treeAdapter.getChildNodes(this.document);
|
|
249
|
-
const docTypeNode = documentChildren.find(node => this.treeAdapter.isDocumentTypeNode(node));
|
|
250
|
-
if (docTypeNode) {
|
|
251
|
-
this.treeAdapter.setNodeSourceCodeLocation(docTypeNode, token.location);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
_attachElementToTree(element, location) {
|
|
256
|
-
if (this.options.sourceCodeLocationInfo) {
|
|
257
|
-
const loc = location && _objectSpread(_objectSpread({}, location), {}, {
|
|
258
|
-
startTag: location
|
|
259
|
-
});
|
|
260
|
-
this.treeAdapter.setNodeSourceCodeLocation(element, loc);
|
|
261
|
-
}
|
|
262
|
-
if (this._shouldFosterParentOnInsertion()) {
|
|
263
|
-
this._fosterParentElement(element);
|
|
264
|
-
} else {
|
|
265
|
-
const parent = this.openElements.currentTmplContentOrNode;
|
|
266
|
-
this.treeAdapter.appendChild(parent, element);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
_appendElement(token, namespaceURI) {
|
|
270
|
-
const element = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs);
|
|
271
|
-
this._attachElementToTree(element, token.location);
|
|
272
|
-
}
|
|
273
|
-
_insertElement(token, namespaceURI) {
|
|
274
|
-
const element = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs);
|
|
275
|
-
this._attachElementToTree(element, token.location);
|
|
276
|
-
this.openElements.push(element, token.tagID);
|
|
277
|
-
}
|
|
278
|
-
_insertFakeElement(tagName, tagID) {
|
|
279
|
-
const element = this.treeAdapter.createElement(tagName, html.NS.HTML, []);
|
|
280
|
-
this._attachElementToTree(element, null);
|
|
281
|
-
this.openElements.push(element, tagID);
|
|
282
|
-
}
|
|
283
|
-
_insertTemplate(token) {
|
|
284
|
-
const tmpl = this.treeAdapter.createElement(token.tagName, html.NS.HTML, token.attrs);
|
|
285
|
-
const content = this.treeAdapter.createDocumentFragment();
|
|
286
|
-
this.treeAdapter.setTemplateContent(tmpl, content);
|
|
287
|
-
this._attachElementToTree(tmpl, token.location);
|
|
288
|
-
this.openElements.push(tmpl, token.tagID);
|
|
289
|
-
if (this.options.sourceCodeLocationInfo) this.treeAdapter.setNodeSourceCodeLocation(content, null);
|
|
290
|
-
}
|
|
291
|
-
_insertFakeRootElement() {
|
|
292
|
-
const element = this.treeAdapter.createElement(html.TAG_NAMES.HTML, html.NS.HTML, []);
|
|
293
|
-
if (this.options.sourceCodeLocationInfo) this.treeAdapter.setNodeSourceCodeLocation(element, null);
|
|
294
|
-
this.treeAdapter.appendChild(this.openElements.current, element);
|
|
295
|
-
this.openElements.push(element, html.TAG_ID.HTML);
|
|
296
|
-
}
|
|
297
|
-
_appendCommentNode(token, parent) {
|
|
298
|
-
const commentNode = this.treeAdapter.createCommentNode(token.data);
|
|
299
|
-
this.treeAdapter.appendChild(parent, commentNode);
|
|
300
|
-
if (this.options.sourceCodeLocationInfo) {
|
|
301
|
-
this.treeAdapter.setNodeSourceCodeLocation(commentNode, token.location);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
_insertCharacters(token) {
|
|
305
|
-
let parent;
|
|
306
|
-
let beforeElement;
|
|
307
|
-
if (this._shouldFosterParentOnInsertion()) {
|
|
308
|
-
var _this$_findFosterPare = this._findFosterParentingLocation();
|
|
309
|
-
parent = _this$_findFosterPare.parent;
|
|
310
|
-
beforeElement = _this$_findFosterPare.beforeElement;
|
|
311
|
-
if (beforeElement) {
|
|
312
|
-
this.treeAdapter.insertTextBefore(parent, token.chars, beforeElement);
|
|
313
|
-
} else {
|
|
314
|
-
this.treeAdapter.insertText(parent, token.chars);
|
|
315
|
-
}
|
|
316
|
-
} else {
|
|
317
|
-
parent = this.openElements.currentTmplContentOrNode;
|
|
318
|
-
this.treeAdapter.insertText(parent, token.chars);
|
|
319
|
-
}
|
|
320
|
-
if (!token.location) return;
|
|
321
|
-
const siblings = this.treeAdapter.getChildNodes(parent);
|
|
322
|
-
const textNodeIdx = beforeElement ? siblings.lastIndexOf(beforeElement) : siblings.length;
|
|
323
|
-
const textNode = siblings[textNodeIdx - 1];
|
|
324
|
-
//NOTE: if we have a location assigned by another token, then just update the end position
|
|
325
|
-
const tnLoc = this.treeAdapter.getNodeSourceCodeLocation(textNode);
|
|
326
|
-
if (tnLoc) {
|
|
327
|
-
const _token$location = token.location,
|
|
328
|
-
endLine = _token$location.endLine,
|
|
329
|
-
endCol = _token$location.endCol,
|
|
330
|
-
endOffset = _token$location.endOffset;
|
|
331
|
-
this.treeAdapter.updateNodeSourceCodeLocation(textNode, {
|
|
332
|
-
endLine,
|
|
333
|
-
endCol,
|
|
334
|
-
endOffset
|
|
335
|
-
});
|
|
336
|
-
} else if (this.options.sourceCodeLocationInfo) {
|
|
337
|
-
this.treeAdapter.setNodeSourceCodeLocation(textNode, token.location);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
_adoptNodes(donor, recipient) {
|
|
341
|
-
for (let child = this.treeAdapter.getFirstChild(donor); child; child = this.treeAdapter.getFirstChild(donor)) {
|
|
342
|
-
this.treeAdapter.detachNode(child);
|
|
343
|
-
this.treeAdapter.appendChild(recipient, child);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
_setEndLocation(element, closingToken) {
|
|
347
|
-
if (this.treeAdapter.getNodeSourceCodeLocation(element) && closingToken.location) {
|
|
348
|
-
const ctLoc = closingToken.location;
|
|
349
|
-
const tn = this.treeAdapter.getTagName(element);
|
|
350
|
-
const endLoc =
|
|
351
|
-
// NOTE: For cases like <p> <p> </p> - First 'p' closes without a closing
|
|
352
|
-
// tag and for cases like <td> <p> </td> - 'p' closes without a closing tag.
|
|
353
|
-
closingToken.type === token.TokenType.END_TAG && tn === closingToken.tagName ? {
|
|
354
|
-
endTag: _objectSpread({}, ctLoc),
|
|
355
|
-
endLine: ctLoc.endLine,
|
|
356
|
-
endCol: ctLoc.endCol,
|
|
357
|
-
endOffset: ctLoc.endOffset
|
|
358
|
-
} : {
|
|
359
|
-
endLine: ctLoc.startLine,
|
|
360
|
-
endCol: ctLoc.startCol,
|
|
361
|
-
endOffset: ctLoc.startOffset
|
|
362
|
-
};
|
|
363
|
-
this.treeAdapter.updateNodeSourceCodeLocation(element, endLoc);
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
//Token processing
|
|
367
|
-
shouldProcessStartTagTokenInForeignContent(token) {
|
|
368
|
-
// Check that neither current === document, or ns === NS.HTML
|
|
369
|
-
if (!this.currentNotInHTML) return false;
|
|
370
|
-
let current;
|
|
371
|
-
let currentTagId;
|
|
372
|
-
if (this.openElements.stackTop === 0 && this.fragmentContext) {
|
|
373
|
-
current = this.fragmentContext;
|
|
374
|
-
currentTagId = this.fragmentContextID;
|
|
375
|
-
} else {
|
|
376
|
-
var _this$openElements2 = this.openElements;
|
|
377
|
-
current = _this$openElements2.current;
|
|
378
|
-
currentTagId = _this$openElements2.currentTagId;
|
|
379
|
-
}
|
|
380
|
-
if (token.tagID === html.TAG_ID.SVG && this.treeAdapter.getTagName(current) === html.TAG_NAMES.ANNOTATION_XML && this.treeAdapter.getNamespaceURI(current) === html.NS.MATHML) {
|
|
381
|
-
return false;
|
|
382
|
-
}
|
|
383
|
-
return (
|
|
384
|
-
// Check that `current` is not an integration point for HTML or MathML elements.
|
|
385
|
-
this.tokenizer.inForeignNode ||
|
|
386
|
-
// If it _is_ an integration point, then we might have to check that it is not an HTML
|
|
387
|
-
// integration point.
|
|
388
|
-
(token.tagID === html.TAG_ID.MGLYPH || token.tagID === html.TAG_ID.MALIGNMARK) && !this._isIntegrationPoint(currentTagId, current, html.NS.HTML)
|
|
389
|
-
);
|
|
390
|
-
}
|
|
391
|
-
_processToken(token$1) {
|
|
392
|
-
switch (token$1.type) {
|
|
393
|
-
case token.TokenType.CHARACTER:
|
|
394
|
-
{
|
|
395
|
-
this.onCharacter(token$1);
|
|
396
|
-
break;
|
|
397
|
-
}
|
|
398
|
-
case token.TokenType.NULL_CHARACTER:
|
|
399
|
-
{
|
|
400
|
-
this.onNullCharacter(token$1);
|
|
401
|
-
break;
|
|
402
|
-
}
|
|
403
|
-
case token.TokenType.COMMENT:
|
|
404
|
-
{
|
|
405
|
-
this.onComment(token$1);
|
|
406
|
-
break;
|
|
407
|
-
}
|
|
408
|
-
case token.TokenType.DOCTYPE:
|
|
409
|
-
{
|
|
410
|
-
this.onDoctype(token$1);
|
|
411
|
-
break;
|
|
412
|
-
}
|
|
413
|
-
case token.TokenType.START_TAG:
|
|
414
|
-
{
|
|
415
|
-
this._processStartTag(token$1);
|
|
416
|
-
break;
|
|
417
|
-
}
|
|
418
|
-
case token.TokenType.END_TAG:
|
|
419
|
-
{
|
|
420
|
-
this.onEndTag(token$1);
|
|
421
|
-
break;
|
|
422
|
-
}
|
|
423
|
-
case token.TokenType.EOF:
|
|
424
|
-
{
|
|
425
|
-
this.onEof(token$1);
|
|
426
|
-
break;
|
|
427
|
-
}
|
|
428
|
-
case token.TokenType.WHITESPACE_CHARACTER:
|
|
429
|
-
{
|
|
430
|
-
this.onWhitespaceCharacter(token$1);
|
|
431
|
-
break;
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
//Integration points
|
|
436
|
-
_isIntegrationPoint(tid, element, foreignNS) {
|
|
437
|
-
const ns = this.treeAdapter.getNamespaceURI(element);
|
|
438
|
-
const attrs = this.treeAdapter.getAttrList(element);
|
|
439
|
-
return foreignContent.isIntegrationPoint(tid, ns, attrs, foreignNS);
|
|
440
|
-
}
|
|
441
|
-
//Active formatting elements reconstruction
|
|
442
|
-
_reconstructActiveFormattingElements() {
|
|
443
|
-
const listLength = this.activeFormattingElements.entries.length;
|
|
444
|
-
if (listLength) {
|
|
445
|
-
const endIndex = this.activeFormattingElements.entries.findIndex(entry => entry.type === formattingElementList.EntryType.Marker || this.openElements.contains(entry.element));
|
|
446
|
-
const unopenIdx = endIndex < 0 ? listLength - 1 : endIndex - 1;
|
|
447
|
-
for (let i = unopenIdx; i >= 0; i--) {
|
|
448
|
-
const entry = this.activeFormattingElements.entries[i];
|
|
449
|
-
this._insertElement(entry.token, this.treeAdapter.getNamespaceURI(entry.element));
|
|
450
|
-
entry.element = this.openElements.current;
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
//Close elements
|
|
455
|
-
_closeTableCell() {
|
|
456
|
-
this.openElements.generateImpliedEndTags();
|
|
457
|
-
this.openElements.popUntilTableCellPopped();
|
|
458
|
-
this.activeFormattingElements.clearToLastMarker();
|
|
459
|
-
this.insertionMode = InsertionMode.IN_ROW;
|
|
460
|
-
}
|
|
461
|
-
_closePElement() {
|
|
462
|
-
this.openElements.generateImpliedEndTagsWithExclusion(html.TAG_ID.P);
|
|
463
|
-
this.openElements.popUntilTagNamePopped(html.TAG_ID.P);
|
|
464
|
-
}
|
|
465
|
-
//Insertion modes
|
|
466
|
-
_resetInsertionMode() {
|
|
467
|
-
for (let i = this.openElements.stackTop; i >= 0; i--) {
|
|
468
|
-
//Insertion mode reset map
|
|
469
|
-
switch (i === 0 && this.fragmentContext ? this.fragmentContextID : this.openElements.tagIDs[i]) {
|
|
470
|
-
case html.TAG_ID.TR:
|
|
471
|
-
{
|
|
472
|
-
this.insertionMode = InsertionMode.IN_ROW;
|
|
473
|
-
return;
|
|
474
|
-
}
|
|
475
|
-
case html.TAG_ID.TBODY:
|
|
476
|
-
case html.TAG_ID.THEAD:
|
|
477
|
-
case html.TAG_ID.TFOOT:
|
|
478
|
-
{
|
|
479
|
-
this.insertionMode = InsertionMode.IN_TABLE_BODY;
|
|
480
|
-
return;
|
|
481
|
-
}
|
|
482
|
-
case html.TAG_ID.CAPTION:
|
|
483
|
-
{
|
|
484
|
-
this.insertionMode = InsertionMode.IN_CAPTION;
|
|
485
|
-
return;
|
|
486
|
-
}
|
|
487
|
-
case html.TAG_ID.COLGROUP:
|
|
488
|
-
{
|
|
489
|
-
this.insertionMode = InsertionMode.IN_COLUMN_GROUP;
|
|
490
|
-
return;
|
|
491
|
-
}
|
|
492
|
-
case html.TAG_ID.TABLE:
|
|
493
|
-
{
|
|
494
|
-
this.insertionMode = InsertionMode.IN_TABLE;
|
|
495
|
-
return;
|
|
496
|
-
}
|
|
497
|
-
case html.TAG_ID.BODY:
|
|
498
|
-
{
|
|
499
|
-
this.insertionMode = InsertionMode.IN_BODY;
|
|
500
|
-
return;
|
|
501
|
-
}
|
|
502
|
-
case html.TAG_ID.FRAMESET:
|
|
503
|
-
{
|
|
504
|
-
this.insertionMode = InsertionMode.IN_FRAMESET;
|
|
505
|
-
return;
|
|
506
|
-
}
|
|
507
|
-
case html.TAG_ID.SELECT:
|
|
508
|
-
{
|
|
509
|
-
this._resetInsertionModeForSelect(i);
|
|
510
|
-
return;
|
|
511
|
-
}
|
|
512
|
-
case html.TAG_ID.TEMPLATE:
|
|
513
|
-
{
|
|
514
|
-
this.insertionMode = this.tmplInsertionModeStack[0];
|
|
515
|
-
return;
|
|
516
|
-
}
|
|
517
|
-
case html.TAG_ID.HTML:
|
|
518
|
-
{
|
|
519
|
-
this.insertionMode = this.headElement ? InsertionMode.AFTER_HEAD : InsertionMode.BEFORE_HEAD;
|
|
520
|
-
return;
|
|
521
|
-
}
|
|
522
|
-
case html.TAG_ID.TD:
|
|
523
|
-
case html.TAG_ID.TH:
|
|
524
|
-
{
|
|
525
|
-
if (i > 0) {
|
|
526
|
-
this.insertionMode = InsertionMode.IN_CELL;
|
|
527
|
-
return;
|
|
528
|
-
}
|
|
529
|
-
break;
|
|
530
|
-
}
|
|
531
|
-
case html.TAG_ID.HEAD:
|
|
532
|
-
{
|
|
533
|
-
if (i > 0) {
|
|
534
|
-
this.insertionMode = InsertionMode.IN_HEAD;
|
|
535
|
-
return;
|
|
536
|
-
}
|
|
537
|
-
break;
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
this.insertionMode = InsertionMode.IN_BODY;
|
|
542
|
-
}
|
|
543
|
-
_resetInsertionModeForSelect(selectIdx) {
|
|
544
|
-
if (selectIdx > 0) {
|
|
545
|
-
for (let i = selectIdx - 1; i > 0; i--) {
|
|
546
|
-
const tn = this.openElements.tagIDs[i];
|
|
547
|
-
if (tn === html.TAG_ID.TEMPLATE) {
|
|
548
|
-
break;
|
|
549
|
-
} else if (tn === html.TAG_ID.TABLE) {
|
|
550
|
-
this.insertionMode = InsertionMode.IN_SELECT_IN_TABLE;
|
|
551
|
-
return;
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
this.insertionMode = InsertionMode.IN_SELECT;
|
|
556
|
-
}
|
|
557
|
-
//Foster parenting
|
|
558
|
-
_isElementCausesFosterParenting(tn) {
|
|
559
|
-
return TABLE_STRUCTURE_TAGS.has(tn);
|
|
560
|
-
}
|
|
561
|
-
_shouldFosterParentOnInsertion() {
|
|
562
|
-
return this.fosterParentingEnabled && this._isElementCausesFosterParenting(this.openElements.currentTagId);
|
|
563
|
-
}
|
|
564
|
-
_findFosterParentingLocation() {
|
|
565
|
-
for (let i = this.openElements.stackTop; i >= 0; i--) {
|
|
566
|
-
const openElement = this.openElements.items[i];
|
|
567
|
-
switch (this.openElements.tagIDs[i]) {
|
|
568
|
-
case html.TAG_ID.TEMPLATE:
|
|
569
|
-
{
|
|
570
|
-
if (this.treeAdapter.getNamespaceURI(openElement) === html.NS.HTML) {
|
|
571
|
-
return {
|
|
572
|
-
parent: this.treeAdapter.getTemplateContent(openElement),
|
|
573
|
-
beforeElement: null
|
|
574
|
-
};
|
|
575
|
-
}
|
|
576
|
-
break;
|
|
577
|
-
}
|
|
578
|
-
case html.TAG_ID.TABLE:
|
|
579
|
-
{
|
|
580
|
-
const parent = this.treeAdapter.getParentNode(openElement);
|
|
581
|
-
if (parent) {
|
|
582
|
-
return {
|
|
583
|
-
parent,
|
|
584
|
-
beforeElement: openElement
|
|
585
|
-
};
|
|
586
|
-
}
|
|
587
|
-
return {
|
|
588
|
-
parent: this.openElements.items[i - 1],
|
|
589
|
-
beforeElement: null
|
|
590
|
-
};
|
|
591
|
-
}
|
|
592
|
-
default:
|
|
593
|
-
// Do nothing
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
return {
|
|
597
|
-
parent: this.openElements.items[0],
|
|
598
|
-
beforeElement: null
|
|
599
|
-
};
|
|
600
|
-
}
|
|
601
|
-
_fosterParentElement(element) {
|
|
602
|
-
const location = this._findFosterParentingLocation();
|
|
603
|
-
if (location.beforeElement) {
|
|
604
|
-
this.treeAdapter.insertBefore(location.parent, element, location.beforeElement);
|
|
605
|
-
} else {
|
|
606
|
-
this.treeAdapter.appendChild(location.parent, element);
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
//Special elements
|
|
610
|
-
_isSpecialElement(element, id) {
|
|
611
|
-
const ns = this.treeAdapter.getNamespaceURI(element);
|
|
612
|
-
return html.SPECIAL_ELEMENTS[ns].has(id);
|
|
613
|
-
}
|
|
614
|
-
onCharacter(token) {
|
|
615
|
-
this.skipNextNewLine = false;
|
|
616
|
-
if (this.tokenizer.inForeignNode) {
|
|
617
|
-
characterInForeignContent(this, token);
|
|
618
|
-
return;
|
|
619
|
-
}
|
|
620
|
-
switch (this.insertionMode) {
|
|
621
|
-
case InsertionMode.INITIAL:
|
|
622
|
-
{
|
|
623
|
-
tokenInInitialMode(this, token);
|
|
624
|
-
break;
|
|
625
|
-
}
|
|
626
|
-
case InsertionMode.BEFORE_HTML:
|
|
627
|
-
{
|
|
628
|
-
tokenBeforeHtml(this, token);
|
|
629
|
-
break;
|
|
630
|
-
}
|
|
631
|
-
case InsertionMode.BEFORE_HEAD:
|
|
632
|
-
{
|
|
633
|
-
tokenBeforeHead(this, token);
|
|
634
|
-
break;
|
|
635
|
-
}
|
|
636
|
-
case InsertionMode.IN_HEAD:
|
|
637
|
-
{
|
|
638
|
-
tokenInHead(this, token);
|
|
639
|
-
break;
|
|
640
|
-
}
|
|
641
|
-
case InsertionMode.IN_HEAD_NO_SCRIPT:
|
|
642
|
-
{
|
|
643
|
-
tokenInHeadNoScript(this, token);
|
|
644
|
-
break;
|
|
645
|
-
}
|
|
646
|
-
case InsertionMode.AFTER_HEAD:
|
|
647
|
-
{
|
|
648
|
-
tokenAfterHead(this, token);
|
|
649
|
-
break;
|
|
650
|
-
}
|
|
651
|
-
case InsertionMode.IN_BODY:
|
|
652
|
-
case InsertionMode.IN_CAPTION:
|
|
653
|
-
case InsertionMode.IN_CELL:
|
|
654
|
-
case InsertionMode.IN_TEMPLATE:
|
|
655
|
-
{
|
|
656
|
-
characterInBody(this, token);
|
|
657
|
-
break;
|
|
658
|
-
}
|
|
659
|
-
case InsertionMode.TEXT:
|
|
660
|
-
case InsertionMode.IN_SELECT:
|
|
661
|
-
case InsertionMode.IN_SELECT_IN_TABLE:
|
|
662
|
-
{
|
|
663
|
-
this._insertCharacters(token);
|
|
664
|
-
break;
|
|
665
|
-
}
|
|
666
|
-
case InsertionMode.IN_TABLE:
|
|
667
|
-
case InsertionMode.IN_TABLE_BODY:
|
|
668
|
-
case InsertionMode.IN_ROW:
|
|
669
|
-
{
|
|
670
|
-
characterInTable(this, token);
|
|
671
|
-
break;
|
|
672
|
-
}
|
|
673
|
-
case InsertionMode.IN_TABLE_TEXT:
|
|
674
|
-
{
|
|
675
|
-
characterInTableText(this, token);
|
|
676
|
-
break;
|
|
677
|
-
}
|
|
678
|
-
case InsertionMode.IN_COLUMN_GROUP:
|
|
679
|
-
{
|
|
680
|
-
tokenInColumnGroup(this, token);
|
|
681
|
-
break;
|
|
682
|
-
}
|
|
683
|
-
case InsertionMode.AFTER_BODY:
|
|
684
|
-
{
|
|
685
|
-
tokenAfterBody(this, token);
|
|
686
|
-
break;
|
|
687
|
-
}
|
|
688
|
-
case InsertionMode.AFTER_AFTER_BODY:
|
|
689
|
-
{
|
|
690
|
-
tokenAfterAfterBody(this, token);
|
|
691
|
-
break;
|
|
692
|
-
}
|
|
693
|
-
default:
|
|
694
|
-
// Do nothing
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
onNullCharacter(token) {
|
|
698
|
-
this.skipNextNewLine = false;
|
|
699
|
-
if (this.tokenizer.inForeignNode) {
|
|
700
|
-
nullCharacterInForeignContent(this, token);
|
|
701
|
-
return;
|
|
702
|
-
}
|
|
703
|
-
switch (this.insertionMode) {
|
|
704
|
-
case InsertionMode.INITIAL:
|
|
705
|
-
{
|
|
706
|
-
tokenInInitialMode(this, token);
|
|
707
|
-
break;
|
|
708
|
-
}
|
|
709
|
-
case InsertionMode.BEFORE_HTML:
|
|
710
|
-
{
|
|
711
|
-
tokenBeforeHtml(this, token);
|
|
712
|
-
break;
|
|
713
|
-
}
|
|
714
|
-
case InsertionMode.BEFORE_HEAD:
|
|
715
|
-
{
|
|
716
|
-
tokenBeforeHead(this, token);
|
|
717
|
-
break;
|
|
718
|
-
}
|
|
719
|
-
case InsertionMode.IN_HEAD:
|
|
720
|
-
{
|
|
721
|
-
tokenInHead(this, token);
|
|
722
|
-
break;
|
|
723
|
-
}
|
|
724
|
-
case InsertionMode.IN_HEAD_NO_SCRIPT:
|
|
725
|
-
{
|
|
726
|
-
tokenInHeadNoScript(this, token);
|
|
727
|
-
break;
|
|
728
|
-
}
|
|
729
|
-
case InsertionMode.AFTER_HEAD:
|
|
730
|
-
{
|
|
731
|
-
tokenAfterHead(this, token);
|
|
732
|
-
break;
|
|
733
|
-
}
|
|
734
|
-
case InsertionMode.TEXT:
|
|
735
|
-
{
|
|
736
|
-
this._insertCharacters(token);
|
|
737
|
-
break;
|
|
738
|
-
}
|
|
739
|
-
case InsertionMode.IN_TABLE:
|
|
740
|
-
case InsertionMode.IN_TABLE_BODY:
|
|
741
|
-
case InsertionMode.IN_ROW:
|
|
742
|
-
{
|
|
743
|
-
characterInTable(this, token);
|
|
744
|
-
break;
|
|
745
|
-
}
|
|
746
|
-
case InsertionMode.IN_COLUMN_GROUP:
|
|
747
|
-
{
|
|
748
|
-
tokenInColumnGroup(this, token);
|
|
749
|
-
break;
|
|
750
|
-
}
|
|
751
|
-
case InsertionMode.AFTER_BODY:
|
|
752
|
-
{
|
|
753
|
-
tokenAfterBody(this, token);
|
|
754
|
-
break;
|
|
755
|
-
}
|
|
756
|
-
case InsertionMode.AFTER_AFTER_BODY:
|
|
757
|
-
{
|
|
758
|
-
tokenAfterAfterBody(this, token);
|
|
759
|
-
break;
|
|
760
|
-
}
|
|
761
|
-
default:
|
|
762
|
-
// Do nothing
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
|
-
onComment(token) {
|
|
766
|
-
this.skipNextNewLine = false;
|
|
767
|
-
if (this.currentNotInHTML) {
|
|
768
|
-
appendComment(this, token);
|
|
769
|
-
return;
|
|
770
|
-
}
|
|
771
|
-
switch (this.insertionMode) {
|
|
772
|
-
case InsertionMode.INITIAL:
|
|
773
|
-
case InsertionMode.BEFORE_HTML:
|
|
774
|
-
case InsertionMode.BEFORE_HEAD:
|
|
775
|
-
case InsertionMode.IN_HEAD:
|
|
776
|
-
case InsertionMode.IN_HEAD_NO_SCRIPT:
|
|
777
|
-
case InsertionMode.AFTER_HEAD:
|
|
778
|
-
case InsertionMode.IN_BODY:
|
|
779
|
-
case InsertionMode.IN_TABLE:
|
|
780
|
-
case InsertionMode.IN_CAPTION:
|
|
781
|
-
case InsertionMode.IN_COLUMN_GROUP:
|
|
782
|
-
case InsertionMode.IN_TABLE_BODY:
|
|
783
|
-
case InsertionMode.IN_ROW:
|
|
784
|
-
case InsertionMode.IN_CELL:
|
|
785
|
-
case InsertionMode.IN_SELECT:
|
|
786
|
-
case InsertionMode.IN_SELECT_IN_TABLE:
|
|
787
|
-
case InsertionMode.IN_TEMPLATE:
|
|
788
|
-
case InsertionMode.IN_FRAMESET:
|
|
789
|
-
case InsertionMode.AFTER_FRAMESET:
|
|
790
|
-
{
|
|
791
|
-
appendComment(this, token);
|
|
792
|
-
break;
|
|
793
|
-
}
|
|
794
|
-
case InsertionMode.IN_TABLE_TEXT:
|
|
795
|
-
{
|
|
796
|
-
tokenInTableText(this, token);
|
|
797
|
-
break;
|
|
798
|
-
}
|
|
799
|
-
case InsertionMode.AFTER_BODY:
|
|
800
|
-
{
|
|
801
|
-
appendCommentToRootHtmlElement(this, token);
|
|
802
|
-
break;
|
|
803
|
-
}
|
|
804
|
-
case InsertionMode.AFTER_AFTER_BODY:
|
|
805
|
-
case InsertionMode.AFTER_AFTER_FRAMESET:
|
|
806
|
-
{
|
|
807
|
-
appendCommentToDocument(this, token);
|
|
808
|
-
break;
|
|
809
|
-
}
|
|
810
|
-
default:
|
|
811
|
-
// Do nothing
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
onDoctype(token) {
|
|
815
|
-
this.skipNextNewLine = false;
|
|
816
|
-
switch (this.insertionMode) {
|
|
817
|
-
case InsertionMode.INITIAL:
|
|
818
|
-
{
|
|
819
|
-
doctypeInInitialMode(this, token);
|
|
820
|
-
break;
|
|
821
|
-
}
|
|
822
|
-
case InsertionMode.BEFORE_HEAD:
|
|
823
|
-
case InsertionMode.IN_HEAD:
|
|
824
|
-
case InsertionMode.IN_HEAD_NO_SCRIPT:
|
|
825
|
-
case InsertionMode.AFTER_HEAD:
|
|
826
|
-
{
|
|
827
|
-
this._err(token, errorCodes.ERR.misplacedDoctype);
|
|
828
|
-
break;
|
|
829
|
-
}
|
|
830
|
-
case InsertionMode.IN_TABLE_TEXT:
|
|
831
|
-
{
|
|
832
|
-
tokenInTableText(this, token);
|
|
833
|
-
break;
|
|
834
|
-
}
|
|
835
|
-
default:
|
|
836
|
-
// Do nothing
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
onStartTag(token) {
|
|
840
|
-
this.skipNextNewLine = false;
|
|
841
|
-
this.currentToken = token;
|
|
842
|
-
this._processStartTag(token);
|
|
843
|
-
if (token.selfClosing && !token.ackSelfClosing) {
|
|
844
|
-
this._err(token, errorCodes.ERR.nonVoidHtmlElementStartTagWithTrailingSolidus);
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
/**
|
|
848
|
-
* Processes a given start tag.
|
|
849
|
-
*
|
|
850
|
-
* `onStartTag` checks if a self-closing tag was recognized. When a token
|
|
851
|
-
* is moved inbetween multiple insertion modes, this check for self-closing
|
|
852
|
-
* could lead to false positives. To avoid this, `_processStartTag` is used
|
|
853
|
-
* for nested calls.
|
|
854
|
-
*
|
|
855
|
-
* @param token The token to process.
|
|
856
|
-
*/
|
|
857
|
-
_processStartTag(token) {
|
|
858
|
-
if (this.shouldProcessStartTagTokenInForeignContent(token)) {
|
|
859
|
-
startTagInForeignContent(this, token);
|
|
860
|
-
} else {
|
|
861
|
-
this._startTagOutsideForeignContent(token);
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
_startTagOutsideForeignContent(token) {
|
|
865
|
-
switch (this.insertionMode) {
|
|
866
|
-
case InsertionMode.INITIAL:
|
|
867
|
-
{
|
|
868
|
-
tokenInInitialMode(this, token);
|
|
869
|
-
break;
|
|
870
|
-
}
|
|
871
|
-
case InsertionMode.BEFORE_HTML:
|
|
872
|
-
{
|
|
873
|
-
startTagBeforeHtml(this, token);
|
|
874
|
-
break;
|
|
875
|
-
}
|
|
876
|
-
case InsertionMode.BEFORE_HEAD:
|
|
877
|
-
{
|
|
878
|
-
startTagBeforeHead(this, token);
|
|
879
|
-
break;
|
|
880
|
-
}
|
|
881
|
-
case InsertionMode.IN_HEAD:
|
|
882
|
-
{
|
|
883
|
-
startTagInHead(this, token);
|
|
884
|
-
break;
|
|
885
|
-
}
|
|
886
|
-
case InsertionMode.IN_HEAD_NO_SCRIPT:
|
|
887
|
-
{
|
|
888
|
-
startTagInHeadNoScript(this, token);
|
|
889
|
-
break;
|
|
890
|
-
}
|
|
891
|
-
case InsertionMode.AFTER_HEAD:
|
|
892
|
-
{
|
|
893
|
-
startTagAfterHead(this, token);
|
|
894
|
-
break;
|
|
895
|
-
}
|
|
896
|
-
case InsertionMode.IN_BODY:
|
|
897
|
-
{
|
|
898
|
-
startTagInBody(this, token);
|
|
899
|
-
break;
|
|
900
|
-
}
|
|
901
|
-
case InsertionMode.IN_TABLE:
|
|
902
|
-
{
|
|
903
|
-
startTagInTable(this, token);
|
|
904
|
-
break;
|
|
905
|
-
}
|
|
906
|
-
case InsertionMode.IN_TABLE_TEXT:
|
|
907
|
-
{
|
|
908
|
-
tokenInTableText(this, token);
|
|
909
|
-
break;
|
|
910
|
-
}
|
|
911
|
-
case InsertionMode.IN_CAPTION:
|
|
912
|
-
{
|
|
913
|
-
startTagInCaption(this, token);
|
|
914
|
-
break;
|
|
915
|
-
}
|
|
916
|
-
case InsertionMode.IN_COLUMN_GROUP:
|
|
917
|
-
{
|
|
918
|
-
startTagInColumnGroup(this, token);
|
|
919
|
-
break;
|
|
920
|
-
}
|
|
921
|
-
case InsertionMode.IN_TABLE_BODY:
|
|
922
|
-
{
|
|
923
|
-
startTagInTableBody(this, token);
|
|
924
|
-
break;
|
|
925
|
-
}
|
|
926
|
-
case InsertionMode.IN_ROW:
|
|
927
|
-
{
|
|
928
|
-
startTagInRow(this, token);
|
|
929
|
-
break;
|
|
930
|
-
}
|
|
931
|
-
case InsertionMode.IN_CELL:
|
|
932
|
-
{
|
|
933
|
-
startTagInCell(this, token);
|
|
934
|
-
break;
|
|
935
|
-
}
|
|
936
|
-
case InsertionMode.IN_SELECT:
|
|
937
|
-
{
|
|
938
|
-
startTagInSelect(this, token);
|
|
939
|
-
break;
|
|
940
|
-
}
|
|
941
|
-
case InsertionMode.IN_SELECT_IN_TABLE:
|
|
942
|
-
{
|
|
943
|
-
startTagInSelectInTable(this, token);
|
|
944
|
-
break;
|
|
945
|
-
}
|
|
946
|
-
case InsertionMode.IN_TEMPLATE:
|
|
947
|
-
{
|
|
948
|
-
startTagInTemplate(this, token);
|
|
949
|
-
break;
|
|
950
|
-
}
|
|
951
|
-
case InsertionMode.AFTER_BODY:
|
|
952
|
-
{
|
|
953
|
-
startTagAfterBody(this, token);
|
|
954
|
-
break;
|
|
955
|
-
}
|
|
956
|
-
case InsertionMode.IN_FRAMESET:
|
|
957
|
-
{
|
|
958
|
-
startTagInFrameset(this, token);
|
|
959
|
-
break;
|
|
960
|
-
}
|
|
961
|
-
case InsertionMode.AFTER_FRAMESET:
|
|
962
|
-
{
|
|
963
|
-
startTagAfterFrameset(this, token);
|
|
964
|
-
break;
|
|
965
|
-
}
|
|
966
|
-
case InsertionMode.AFTER_AFTER_BODY:
|
|
967
|
-
{
|
|
968
|
-
startTagAfterAfterBody(this, token);
|
|
969
|
-
break;
|
|
970
|
-
}
|
|
971
|
-
case InsertionMode.AFTER_AFTER_FRAMESET:
|
|
972
|
-
{
|
|
973
|
-
startTagAfterAfterFrameset(this, token);
|
|
974
|
-
break;
|
|
975
|
-
}
|
|
976
|
-
default:
|
|
977
|
-
// Do nothing
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
onEndTag(token) {
|
|
981
|
-
this.skipNextNewLine = false;
|
|
982
|
-
this.currentToken = token;
|
|
983
|
-
if (this.currentNotInHTML) {
|
|
984
|
-
endTagInForeignContent(this, token);
|
|
985
|
-
} else {
|
|
986
|
-
this._endTagOutsideForeignContent(token);
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
_endTagOutsideForeignContent(token) {
|
|
990
|
-
switch (this.insertionMode) {
|
|
991
|
-
case InsertionMode.INITIAL:
|
|
992
|
-
{
|
|
993
|
-
tokenInInitialMode(this, token);
|
|
994
|
-
break;
|
|
995
|
-
}
|
|
996
|
-
case InsertionMode.BEFORE_HTML:
|
|
997
|
-
{
|
|
998
|
-
endTagBeforeHtml(this, token);
|
|
999
|
-
break;
|
|
1000
|
-
}
|
|
1001
|
-
case InsertionMode.BEFORE_HEAD:
|
|
1002
|
-
{
|
|
1003
|
-
endTagBeforeHead(this, token);
|
|
1004
|
-
break;
|
|
1005
|
-
}
|
|
1006
|
-
case InsertionMode.IN_HEAD:
|
|
1007
|
-
{
|
|
1008
|
-
endTagInHead(this, token);
|
|
1009
|
-
break;
|
|
1010
|
-
}
|
|
1011
|
-
case InsertionMode.IN_HEAD_NO_SCRIPT:
|
|
1012
|
-
{
|
|
1013
|
-
endTagInHeadNoScript(this, token);
|
|
1014
|
-
break;
|
|
1015
|
-
}
|
|
1016
|
-
case InsertionMode.AFTER_HEAD:
|
|
1017
|
-
{
|
|
1018
|
-
endTagAfterHead(this, token);
|
|
1019
|
-
break;
|
|
1020
|
-
}
|
|
1021
|
-
case InsertionMode.IN_BODY:
|
|
1022
|
-
{
|
|
1023
|
-
endTagInBody(this, token);
|
|
1024
|
-
break;
|
|
1025
|
-
}
|
|
1026
|
-
case InsertionMode.TEXT:
|
|
1027
|
-
{
|
|
1028
|
-
endTagInText(this, token);
|
|
1029
|
-
break;
|
|
1030
|
-
}
|
|
1031
|
-
case InsertionMode.IN_TABLE:
|
|
1032
|
-
{
|
|
1033
|
-
endTagInTable(this, token);
|
|
1034
|
-
break;
|
|
1035
|
-
}
|
|
1036
|
-
case InsertionMode.IN_TABLE_TEXT:
|
|
1037
|
-
{
|
|
1038
|
-
tokenInTableText(this, token);
|
|
1039
|
-
break;
|
|
1040
|
-
}
|
|
1041
|
-
case InsertionMode.IN_CAPTION:
|
|
1042
|
-
{
|
|
1043
|
-
endTagInCaption(this, token);
|
|
1044
|
-
break;
|
|
1045
|
-
}
|
|
1046
|
-
case InsertionMode.IN_COLUMN_GROUP:
|
|
1047
|
-
{
|
|
1048
|
-
endTagInColumnGroup(this, token);
|
|
1049
|
-
break;
|
|
1050
|
-
}
|
|
1051
|
-
case InsertionMode.IN_TABLE_BODY:
|
|
1052
|
-
{
|
|
1053
|
-
endTagInTableBody(this, token);
|
|
1054
|
-
break;
|
|
1055
|
-
}
|
|
1056
|
-
case InsertionMode.IN_ROW:
|
|
1057
|
-
{
|
|
1058
|
-
endTagInRow(this, token);
|
|
1059
|
-
break;
|
|
1060
|
-
}
|
|
1061
|
-
case InsertionMode.IN_CELL:
|
|
1062
|
-
{
|
|
1063
|
-
endTagInCell(this, token);
|
|
1064
|
-
break;
|
|
1065
|
-
}
|
|
1066
|
-
case InsertionMode.IN_SELECT:
|
|
1067
|
-
{
|
|
1068
|
-
endTagInSelect(this, token);
|
|
1069
|
-
break;
|
|
1070
|
-
}
|
|
1071
|
-
case InsertionMode.IN_SELECT_IN_TABLE:
|
|
1072
|
-
{
|
|
1073
|
-
endTagInSelectInTable(this, token);
|
|
1074
|
-
break;
|
|
1075
|
-
}
|
|
1076
|
-
case InsertionMode.IN_TEMPLATE:
|
|
1077
|
-
{
|
|
1078
|
-
endTagInTemplate(this, token);
|
|
1079
|
-
break;
|
|
1080
|
-
}
|
|
1081
|
-
case InsertionMode.AFTER_BODY:
|
|
1082
|
-
{
|
|
1083
|
-
endTagAfterBody(this, token);
|
|
1084
|
-
break;
|
|
1085
|
-
}
|
|
1086
|
-
case InsertionMode.IN_FRAMESET:
|
|
1087
|
-
{
|
|
1088
|
-
endTagInFrameset(this, token);
|
|
1089
|
-
break;
|
|
1090
|
-
}
|
|
1091
|
-
case InsertionMode.AFTER_FRAMESET:
|
|
1092
|
-
{
|
|
1093
|
-
endTagAfterFrameset(this, token);
|
|
1094
|
-
break;
|
|
1095
|
-
}
|
|
1096
|
-
case InsertionMode.AFTER_AFTER_BODY:
|
|
1097
|
-
{
|
|
1098
|
-
tokenAfterAfterBody(this, token);
|
|
1099
|
-
break;
|
|
1100
|
-
}
|
|
1101
|
-
default:
|
|
1102
|
-
// Do nothing
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
|
-
onEof(token) {
|
|
1106
|
-
switch (this.insertionMode) {
|
|
1107
|
-
case InsertionMode.INITIAL:
|
|
1108
|
-
{
|
|
1109
|
-
tokenInInitialMode(this, token);
|
|
1110
|
-
break;
|
|
1111
|
-
}
|
|
1112
|
-
case InsertionMode.BEFORE_HTML:
|
|
1113
|
-
{
|
|
1114
|
-
tokenBeforeHtml(this, token);
|
|
1115
|
-
break;
|
|
1116
|
-
}
|
|
1117
|
-
case InsertionMode.BEFORE_HEAD:
|
|
1118
|
-
{
|
|
1119
|
-
tokenBeforeHead(this, token);
|
|
1120
|
-
break;
|
|
1121
|
-
}
|
|
1122
|
-
case InsertionMode.IN_HEAD:
|
|
1123
|
-
{
|
|
1124
|
-
tokenInHead(this, token);
|
|
1125
|
-
break;
|
|
1126
|
-
}
|
|
1127
|
-
case InsertionMode.IN_HEAD_NO_SCRIPT:
|
|
1128
|
-
{
|
|
1129
|
-
tokenInHeadNoScript(this, token);
|
|
1130
|
-
break;
|
|
1131
|
-
}
|
|
1132
|
-
case InsertionMode.AFTER_HEAD:
|
|
1133
|
-
{
|
|
1134
|
-
tokenAfterHead(this, token);
|
|
1135
|
-
break;
|
|
1136
|
-
}
|
|
1137
|
-
case InsertionMode.IN_BODY:
|
|
1138
|
-
case InsertionMode.IN_TABLE:
|
|
1139
|
-
case InsertionMode.IN_CAPTION:
|
|
1140
|
-
case InsertionMode.IN_COLUMN_GROUP:
|
|
1141
|
-
case InsertionMode.IN_TABLE_BODY:
|
|
1142
|
-
case InsertionMode.IN_ROW:
|
|
1143
|
-
case InsertionMode.IN_CELL:
|
|
1144
|
-
case InsertionMode.IN_SELECT:
|
|
1145
|
-
case InsertionMode.IN_SELECT_IN_TABLE:
|
|
1146
|
-
{
|
|
1147
|
-
eofInBody(this, token);
|
|
1148
|
-
break;
|
|
1149
|
-
}
|
|
1150
|
-
case InsertionMode.TEXT:
|
|
1151
|
-
{
|
|
1152
|
-
eofInText(this, token);
|
|
1153
|
-
break;
|
|
1154
|
-
}
|
|
1155
|
-
case InsertionMode.IN_TABLE_TEXT:
|
|
1156
|
-
{
|
|
1157
|
-
tokenInTableText(this, token);
|
|
1158
|
-
break;
|
|
1159
|
-
}
|
|
1160
|
-
case InsertionMode.IN_TEMPLATE:
|
|
1161
|
-
{
|
|
1162
|
-
eofInTemplate(this, token);
|
|
1163
|
-
break;
|
|
1164
|
-
}
|
|
1165
|
-
case InsertionMode.AFTER_BODY:
|
|
1166
|
-
case InsertionMode.IN_FRAMESET:
|
|
1167
|
-
case InsertionMode.AFTER_FRAMESET:
|
|
1168
|
-
case InsertionMode.AFTER_AFTER_BODY:
|
|
1169
|
-
case InsertionMode.AFTER_AFTER_FRAMESET:
|
|
1170
|
-
{
|
|
1171
|
-
stopParsing(this, token);
|
|
1172
|
-
break;
|
|
1173
|
-
}
|
|
1174
|
-
default:
|
|
1175
|
-
// Do nothing
|
|
1176
|
-
}
|
|
1177
|
-
}
|
|
1178
|
-
onWhitespaceCharacter(token) {
|
|
1179
|
-
if (this.skipNextNewLine) {
|
|
1180
|
-
this.skipNextNewLine = false;
|
|
1181
|
-
if (token.chars.charCodeAt(0) === unicode.CODE_POINTS.LINE_FEED) {
|
|
1182
|
-
if (token.chars.length === 1) {
|
|
1183
|
-
return;
|
|
1184
|
-
}
|
|
1185
|
-
token.chars = token.chars.substr(1);
|
|
1186
|
-
}
|
|
1187
|
-
}
|
|
1188
|
-
if (this.tokenizer.inForeignNode) {
|
|
1189
|
-
this._insertCharacters(token);
|
|
1190
|
-
return;
|
|
1191
|
-
}
|
|
1192
|
-
switch (this.insertionMode) {
|
|
1193
|
-
case InsertionMode.IN_HEAD:
|
|
1194
|
-
case InsertionMode.IN_HEAD_NO_SCRIPT:
|
|
1195
|
-
case InsertionMode.AFTER_HEAD:
|
|
1196
|
-
case InsertionMode.TEXT:
|
|
1197
|
-
case InsertionMode.IN_COLUMN_GROUP:
|
|
1198
|
-
case InsertionMode.IN_SELECT:
|
|
1199
|
-
case InsertionMode.IN_SELECT_IN_TABLE:
|
|
1200
|
-
case InsertionMode.IN_FRAMESET:
|
|
1201
|
-
case InsertionMode.AFTER_FRAMESET:
|
|
1202
|
-
{
|
|
1203
|
-
this._insertCharacters(token);
|
|
1204
|
-
break;
|
|
1205
|
-
}
|
|
1206
|
-
case InsertionMode.IN_BODY:
|
|
1207
|
-
case InsertionMode.IN_CAPTION:
|
|
1208
|
-
case InsertionMode.IN_CELL:
|
|
1209
|
-
case InsertionMode.IN_TEMPLATE:
|
|
1210
|
-
case InsertionMode.AFTER_BODY:
|
|
1211
|
-
case InsertionMode.AFTER_AFTER_BODY:
|
|
1212
|
-
case InsertionMode.AFTER_AFTER_FRAMESET:
|
|
1213
|
-
{
|
|
1214
|
-
whitespaceCharacterInBody(this, token);
|
|
1215
|
-
break;
|
|
1216
|
-
}
|
|
1217
|
-
case InsertionMode.IN_TABLE:
|
|
1218
|
-
case InsertionMode.IN_TABLE_BODY:
|
|
1219
|
-
case InsertionMode.IN_ROW:
|
|
1220
|
-
{
|
|
1221
|
-
characterInTable(this, token);
|
|
1222
|
-
break;
|
|
1223
|
-
}
|
|
1224
|
-
case InsertionMode.IN_TABLE_TEXT:
|
|
1225
|
-
{
|
|
1226
|
-
whitespaceCharacterInTableText(this, token);
|
|
1227
|
-
break;
|
|
1228
|
-
}
|
|
1229
|
-
default:
|
|
1230
|
-
// Do nothing
|
|
1231
|
-
}
|
|
1232
|
-
}
|
|
1233
|
-
}
|
|
1234
|
-
//Adoption agency algorithm
|
|
1235
|
-
//(see: http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#adoptionAgency)
|
|
1236
|
-
//------------------------------------------------------------------
|
|
1237
|
-
//Steps 5-8 of the algorithm
|
|
1238
|
-
function aaObtainFormattingElementEntry(p, token) {
|
|
1239
|
-
let formattingElementEntry = p.activeFormattingElements.getElementEntryInScopeWithTagName(token.tagName);
|
|
1240
|
-
if (formattingElementEntry) {
|
|
1241
|
-
if (!p.openElements.contains(formattingElementEntry.element)) {
|
|
1242
|
-
p.activeFormattingElements.removeEntry(formattingElementEntry);
|
|
1243
|
-
formattingElementEntry = null;
|
|
1244
|
-
} else if (!p.openElements.hasInScope(token.tagID)) {
|
|
1245
|
-
formattingElementEntry = null;
|
|
1246
|
-
}
|
|
1247
|
-
} else {
|
|
1248
|
-
genericEndTagInBody(p, token);
|
|
1249
|
-
}
|
|
1250
|
-
return formattingElementEntry;
|
|
1251
|
-
}
|
|
1252
|
-
//Steps 9 and 10 of the algorithm
|
|
1253
|
-
function aaObtainFurthestBlock(p, formattingElementEntry) {
|
|
1254
|
-
let furthestBlock = null;
|
|
1255
|
-
let idx = p.openElements.stackTop;
|
|
1256
|
-
for (; idx >= 0; idx--) {
|
|
1257
|
-
const element = p.openElements.items[idx];
|
|
1258
|
-
if (element === formattingElementEntry.element) {
|
|
1259
|
-
break;
|
|
1260
|
-
}
|
|
1261
|
-
if (p._isSpecialElement(element, p.openElements.tagIDs[idx])) {
|
|
1262
|
-
furthestBlock = element;
|
|
1263
|
-
}
|
|
1264
|
-
}
|
|
1265
|
-
if (!furthestBlock) {
|
|
1266
|
-
p.openElements.shortenToLength(idx < 0 ? 0 : idx);
|
|
1267
|
-
p.activeFormattingElements.removeEntry(formattingElementEntry);
|
|
1268
|
-
}
|
|
1269
|
-
return furthestBlock;
|
|
1270
|
-
}
|
|
1271
|
-
//Step 13 of the algorithm
|
|
1272
|
-
function aaInnerLoop(p, furthestBlock, formattingElement) {
|
|
1273
|
-
let lastElement = furthestBlock;
|
|
1274
|
-
let nextElement = p.openElements.getCommonAncestor(furthestBlock);
|
|
1275
|
-
for (let i = 0, element = nextElement; element !== formattingElement; i++, element = nextElement) {
|
|
1276
|
-
//NOTE: store the next element for the next loop iteration (it may be deleted from the stack by step 9.5)
|
|
1277
|
-
nextElement = p.openElements.getCommonAncestor(element);
|
|
1278
|
-
const elementEntry = p.activeFormattingElements.getElementEntry(element);
|
|
1279
|
-
const counterOverflow = elementEntry && i >= AA_INNER_LOOP_ITER;
|
|
1280
|
-
const shouldRemoveFromOpenElements = !elementEntry || counterOverflow;
|
|
1281
|
-
if (shouldRemoveFromOpenElements) {
|
|
1282
|
-
if (counterOverflow) {
|
|
1283
|
-
p.activeFormattingElements.removeEntry(elementEntry);
|
|
1284
|
-
}
|
|
1285
|
-
p.openElements.remove(element);
|
|
1286
|
-
} else {
|
|
1287
|
-
element = aaRecreateElementFromEntry(p, elementEntry);
|
|
1288
|
-
if (lastElement === furthestBlock) {
|
|
1289
|
-
p.activeFormattingElements.bookmark = elementEntry;
|
|
1290
|
-
}
|
|
1291
|
-
p.treeAdapter.detachNode(lastElement);
|
|
1292
|
-
p.treeAdapter.appendChild(element, lastElement);
|
|
1293
|
-
lastElement = element;
|
|
1294
|
-
}
|
|
1295
|
-
}
|
|
1296
|
-
return lastElement;
|
|
1297
|
-
}
|
|
1298
|
-
//Step 13.7 of the algorithm
|
|
1299
|
-
function aaRecreateElementFromEntry(p, elementEntry) {
|
|
1300
|
-
const ns = p.treeAdapter.getNamespaceURI(elementEntry.element);
|
|
1301
|
-
const newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);
|
|
1302
|
-
p.openElements.replace(elementEntry.element, newElement);
|
|
1303
|
-
elementEntry.element = newElement;
|
|
1304
|
-
return newElement;
|
|
1305
|
-
}
|
|
1306
|
-
//Step 14 of the algorithm
|
|
1307
|
-
function aaInsertLastNodeInCommonAncestor(p, commonAncestor, lastElement) {
|
|
1308
|
-
const tn = p.treeAdapter.getTagName(commonAncestor);
|
|
1309
|
-
const tid = html.getTagID(tn);
|
|
1310
|
-
if (p._isElementCausesFosterParenting(tid)) {
|
|
1311
|
-
p._fosterParentElement(lastElement);
|
|
1312
|
-
} else {
|
|
1313
|
-
const ns = p.treeAdapter.getNamespaceURI(commonAncestor);
|
|
1314
|
-
if (tid === html.TAG_ID.TEMPLATE && ns === html.NS.HTML) {
|
|
1315
|
-
commonAncestor = p.treeAdapter.getTemplateContent(commonAncestor);
|
|
1316
|
-
}
|
|
1317
|
-
p.treeAdapter.appendChild(commonAncestor, lastElement);
|
|
1318
|
-
}
|
|
1319
|
-
}
|
|
1320
|
-
//Steps 15-19 of the algorithm
|
|
1321
|
-
function aaReplaceFormattingElement(p, furthestBlock, formattingElementEntry) {
|
|
1322
|
-
const ns = p.treeAdapter.getNamespaceURI(formattingElementEntry.element);
|
|
1323
|
-
const token = formattingElementEntry.token;
|
|
1324
|
-
const newElement = p.treeAdapter.createElement(token.tagName, ns, token.attrs);
|
|
1325
|
-
p._adoptNodes(furthestBlock, newElement);
|
|
1326
|
-
p.treeAdapter.appendChild(furthestBlock, newElement);
|
|
1327
|
-
p.activeFormattingElements.insertElementAfterBookmark(newElement, token);
|
|
1328
|
-
p.activeFormattingElements.removeEntry(formattingElementEntry);
|
|
1329
|
-
p.openElements.remove(formattingElementEntry.element);
|
|
1330
|
-
p.openElements.insertAfter(furthestBlock, newElement, token.tagID);
|
|
1331
|
-
}
|
|
1332
|
-
//Algorithm entry point
|
|
1333
|
-
function callAdoptionAgency(p, token) {
|
|
1334
|
-
for (let i = 0; i < AA_OUTER_LOOP_ITER; i++) {
|
|
1335
|
-
const formattingElementEntry = aaObtainFormattingElementEntry(p, token);
|
|
1336
|
-
if (!formattingElementEntry) {
|
|
1337
|
-
break;
|
|
1338
|
-
}
|
|
1339
|
-
const furthestBlock = aaObtainFurthestBlock(p, formattingElementEntry);
|
|
1340
|
-
if (!furthestBlock) {
|
|
1341
|
-
break;
|
|
1342
|
-
}
|
|
1343
|
-
p.activeFormattingElements.bookmark = formattingElementEntry;
|
|
1344
|
-
const lastElement = aaInnerLoop(p, furthestBlock, formattingElementEntry.element);
|
|
1345
|
-
const commonAncestor = p.openElements.getCommonAncestor(formattingElementEntry.element);
|
|
1346
|
-
p.treeAdapter.detachNode(lastElement);
|
|
1347
|
-
if (commonAncestor) aaInsertLastNodeInCommonAncestor(p, commonAncestor, lastElement);
|
|
1348
|
-
aaReplaceFormattingElement(p, furthestBlock, formattingElementEntry);
|
|
1349
|
-
}
|
|
1350
|
-
}
|
|
1351
|
-
//Generic token handlers
|
|
1352
|
-
//------------------------------------------------------------------
|
|
1353
|
-
function appendComment(p, token) {
|
|
1354
|
-
p._appendCommentNode(token, p.openElements.currentTmplContentOrNode);
|
|
1355
|
-
}
|
|
1356
|
-
function appendCommentToRootHtmlElement(p, token) {
|
|
1357
|
-
p._appendCommentNode(token, p.openElements.items[0]);
|
|
1358
|
-
}
|
|
1359
|
-
function appendCommentToDocument(p, token) {
|
|
1360
|
-
p._appendCommentNode(token, p.document);
|
|
1361
|
-
}
|
|
1362
|
-
function stopParsing(p, token) {
|
|
1363
|
-
p.stopped = true;
|
|
1364
|
-
// NOTE: Set end locations for elements that remain on the open element stack.
|
|
1365
|
-
if (token.location) {
|
|
1366
|
-
// NOTE: If we are not in a fragment, `html` and `body` will stay on the stack.
|
|
1367
|
-
// This is a problem, as we might overwrite their end position here.
|
|
1368
|
-
const target = p.fragmentContext ? 0 : 2;
|
|
1369
|
-
for (let i = p.openElements.stackTop; i >= target; i--) {
|
|
1370
|
-
p._setEndLocation(p.openElements.items[i], token);
|
|
1371
|
-
}
|
|
1372
|
-
// Handle `html` and `body`
|
|
1373
|
-
if (!p.fragmentContext && p.openElements.stackTop >= 0) {
|
|
1374
|
-
const htmlElement = p.openElements.items[0];
|
|
1375
|
-
const htmlLocation = p.treeAdapter.getNodeSourceCodeLocation(htmlElement);
|
|
1376
|
-
if (htmlLocation && !htmlLocation.endTag) {
|
|
1377
|
-
p._setEndLocation(htmlElement, token);
|
|
1378
|
-
if (p.openElements.stackTop >= 1) {
|
|
1379
|
-
const bodyElement = p.openElements.items[1];
|
|
1380
|
-
const bodyLocation = p.treeAdapter.getNodeSourceCodeLocation(bodyElement);
|
|
1381
|
-
if (bodyLocation && !bodyLocation.endTag) {
|
|
1382
|
-
p._setEndLocation(bodyElement, token);
|
|
1383
|
-
}
|
|
1384
|
-
}
|
|
1385
|
-
}
|
|
1386
|
-
}
|
|
1387
|
-
}
|
|
1388
|
-
}
|
|
1389
|
-
// The "initial" insertion mode
|
|
1390
|
-
//------------------------------------------------------------------
|
|
1391
|
-
function doctypeInInitialMode(p, token) {
|
|
1392
|
-
p._setDocumentType(token);
|
|
1393
|
-
const mode = token.forceQuirks ? html.DOCUMENT_MODE.QUIRKS : doctype.getDocumentMode(token);
|
|
1394
|
-
if (!doctype.isConforming(token)) {
|
|
1395
|
-
p._err(token, errorCodes.ERR.nonConformingDoctype);
|
|
1396
|
-
}
|
|
1397
|
-
p.treeAdapter.setDocumentMode(p.document, mode);
|
|
1398
|
-
p.insertionMode = InsertionMode.BEFORE_HTML;
|
|
1399
|
-
}
|
|
1400
|
-
function tokenInInitialMode(p, token) {
|
|
1401
|
-
p._err(token, errorCodes.ERR.missingDoctype, true);
|
|
1402
|
-
p.treeAdapter.setDocumentMode(p.document, html.DOCUMENT_MODE.QUIRKS);
|
|
1403
|
-
p.insertionMode = InsertionMode.BEFORE_HTML;
|
|
1404
|
-
p._processToken(token);
|
|
1405
|
-
}
|
|
1406
|
-
// The "before html" insertion mode
|
|
1407
|
-
//------------------------------------------------------------------
|
|
1408
|
-
function startTagBeforeHtml(p, token) {
|
|
1409
|
-
if (token.tagID === html.TAG_ID.HTML) {
|
|
1410
|
-
p._insertElement(token, html.NS.HTML);
|
|
1411
|
-
p.insertionMode = InsertionMode.BEFORE_HEAD;
|
|
1412
|
-
} else {
|
|
1413
|
-
tokenBeforeHtml(p, token);
|
|
1414
|
-
}
|
|
1415
|
-
}
|
|
1416
|
-
function endTagBeforeHtml(p, token) {
|
|
1417
|
-
const tn = token.tagID;
|
|
1418
|
-
if (tn === html.TAG_ID.HTML || tn === html.TAG_ID.HEAD || tn === html.TAG_ID.BODY || tn === html.TAG_ID.BR) {
|
|
1419
|
-
tokenBeforeHtml(p, token);
|
|
1420
|
-
}
|
|
1421
|
-
}
|
|
1422
|
-
function tokenBeforeHtml(p, token) {
|
|
1423
|
-
p._insertFakeRootElement();
|
|
1424
|
-
p.insertionMode = InsertionMode.BEFORE_HEAD;
|
|
1425
|
-
p._processToken(token);
|
|
1426
|
-
}
|
|
1427
|
-
// The "before head" insertion mode
|
|
1428
|
-
//------------------------------------------------------------------
|
|
1429
|
-
function startTagBeforeHead(p, token) {
|
|
1430
|
-
switch (token.tagID) {
|
|
1431
|
-
case html.TAG_ID.HTML:
|
|
1432
|
-
{
|
|
1433
|
-
startTagInBody(p, token);
|
|
1434
|
-
break;
|
|
1435
|
-
}
|
|
1436
|
-
case html.TAG_ID.HEAD:
|
|
1437
|
-
{
|
|
1438
|
-
p._insertElement(token, html.NS.HTML);
|
|
1439
|
-
p.headElement = p.openElements.current;
|
|
1440
|
-
p.insertionMode = InsertionMode.IN_HEAD;
|
|
1441
|
-
break;
|
|
1442
|
-
}
|
|
1443
|
-
default:
|
|
1444
|
-
{
|
|
1445
|
-
tokenBeforeHead(p, token);
|
|
1446
|
-
}
|
|
1447
|
-
}
|
|
1448
|
-
}
|
|
1449
|
-
function endTagBeforeHead(p, token) {
|
|
1450
|
-
const tn = token.tagID;
|
|
1451
|
-
if (tn === html.TAG_ID.HEAD || tn === html.TAG_ID.BODY || tn === html.TAG_ID.HTML || tn === html.TAG_ID.BR) {
|
|
1452
|
-
tokenBeforeHead(p, token);
|
|
1453
|
-
} else {
|
|
1454
|
-
p._err(token, errorCodes.ERR.endTagWithoutMatchingOpenElement);
|
|
1455
|
-
}
|
|
1456
|
-
}
|
|
1457
|
-
function tokenBeforeHead(p, token) {
|
|
1458
|
-
p._insertFakeElement(html.TAG_NAMES.HEAD, html.TAG_ID.HEAD);
|
|
1459
|
-
p.headElement = p.openElements.current;
|
|
1460
|
-
p.insertionMode = InsertionMode.IN_HEAD;
|
|
1461
|
-
p._processToken(token);
|
|
1462
|
-
}
|
|
1463
|
-
// The "in head" insertion mode
|
|
1464
|
-
//------------------------------------------------------------------
|
|
1465
|
-
function startTagInHead(p, token) {
|
|
1466
|
-
switch (token.tagID) {
|
|
1467
|
-
case html.TAG_ID.HTML:
|
|
1468
|
-
{
|
|
1469
|
-
startTagInBody(p, token);
|
|
1470
|
-
break;
|
|
1471
|
-
}
|
|
1472
|
-
case html.TAG_ID.BASE:
|
|
1473
|
-
case html.TAG_ID.BASEFONT:
|
|
1474
|
-
case html.TAG_ID.BGSOUND:
|
|
1475
|
-
case html.TAG_ID.LINK:
|
|
1476
|
-
case html.TAG_ID.META:
|
|
1477
|
-
{
|
|
1478
|
-
p._appendElement(token, html.NS.HTML);
|
|
1479
|
-
token.ackSelfClosing = true;
|
|
1480
|
-
break;
|
|
1481
|
-
}
|
|
1482
|
-
case html.TAG_ID.TITLE:
|
|
1483
|
-
{
|
|
1484
|
-
p._switchToTextParsing(token, index.TokenizerMode.RCDATA);
|
|
1485
|
-
break;
|
|
1486
|
-
}
|
|
1487
|
-
case html.TAG_ID.NOSCRIPT:
|
|
1488
|
-
{
|
|
1489
|
-
if (p.options.scriptingEnabled) {
|
|
1490
|
-
p._switchToTextParsing(token, index.TokenizerMode.RAWTEXT);
|
|
1491
|
-
} else {
|
|
1492
|
-
p._insertElement(token, html.NS.HTML);
|
|
1493
|
-
p.insertionMode = InsertionMode.IN_HEAD_NO_SCRIPT;
|
|
1494
|
-
}
|
|
1495
|
-
break;
|
|
1496
|
-
}
|
|
1497
|
-
case html.TAG_ID.NOFRAMES:
|
|
1498
|
-
case html.TAG_ID.STYLE:
|
|
1499
|
-
{
|
|
1500
|
-
p._switchToTextParsing(token, index.TokenizerMode.RAWTEXT);
|
|
1501
|
-
break;
|
|
1502
|
-
}
|
|
1503
|
-
case html.TAG_ID.SCRIPT:
|
|
1504
|
-
{
|
|
1505
|
-
p._switchToTextParsing(token, index.TokenizerMode.SCRIPT_DATA);
|
|
1506
|
-
break;
|
|
1507
|
-
}
|
|
1508
|
-
case html.TAG_ID.TEMPLATE:
|
|
1509
|
-
{
|
|
1510
|
-
p._insertTemplate(token);
|
|
1511
|
-
p.activeFormattingElements.insertMarker();
|
|
1512
|
-
p.framesetOk = false;
|
|
1513
|
-
p.insertionMode = InsertionMode.IN_TEMPLATE;
|
|
1514
|
-
p.tmplInsertionModeStack.unshift(InsertionMode.IN_TEMPLATE);
|
|
1515
|
-
break;
|
|
1516
|
-
}
|
|
1517
|
-
case html.TAG_ID.HEAD:
|
|
1518
|
-
{
|
|
1519
|
-
p._err(token, errorCodes.ERR.misplacedStartTagForHeadElement);
|
|
1520
|
-
break;
|
|
1521
|
-
}
|
|
1522
|
-
default:
|
|
1523
|
-
{
|
|
1524
|
-
tokenInHead(p, token);
|
|
1525
|
-
}
|
|
1526
|
-
}
|
|
1527
|
-
}
|
|
1528
|
-
function endTagInHead(p, token) {
|
|
1529
|
-
switch (token.tagID) {
|
|
1530
|
-
case html.TAG_ID.HEAD:
|
|
1531
|
-
{
|
|
1532
|
-
p.openElements.pop();
|
|
1533
|
-
p.insertionMode = InsertionMode.AFTER_HEAD;
|
|
1534
|
-
break;
|
|
1535
|
-
}
|
|
1536
|
-
case html.TAG_ID.BODY:
|
|
1537
|
-
case html.TAG_ID.BR:
|
|
1538
|
-
case html.TAG_ID.HTML:
|
|
1539
|
-
{
|
|
1540
|
-
tokenInHead(p, token);
|
|
1541
|
-
break;
|
|
1542
|
-
}
|
|
1543
|
-
case html.TAG_ID.TEMPLATE:
|
|
1544
|
-
{
|
|
1545
|
-
templateEndTagInHead(p, token);
|
|
1546
|
-
break;
|
|
1547
|
-
}
|
|
1548
|
-
default:
|
|
1549
|
-
{
|
|
1550
|
-
p._err(token, errorCodes.ERR.endTagWithoutMatchingOpenElement);
|
|
1551
|
-
}
|
|
1552
|
-
}
|
|
1553
|
-
}
|
|
1554
|
-
function templateEndTagInHead(p, token) {
|
|
1555
|
-
if (p.openElements.tmplCount > 0) {
|
|
1556
|
-
p.openElements.generateImpliedEndTagsThoroughly();
|
|
1557
|
-
if (p.openElements.currentTagId !== html.TAG_ID.TEMPLATE) {
|
|
1558
|
-
p._err(token, errorCodes.ERR.closingOfElementWithOpenChildElements);
|
|
1559
|
-
}
|
|
1560
|
-
p.openElements.popUntilTagNamePopped(html.TAG_ID.TEMPLATE);
|
|
1561
|
-
p.activeFormattingElements.clearToLastMarker();
|
|
1562
|
-
p.tmplInsertionModeStack.shift();
|
|
1563
|
-
p._resetInsertionMode();
|
|
1564
|
-
} else {
|
|
1565
|
-
p._err(token, errorCodes.ERR.endTagWithoutMatchingOpenElement);
|
|
1566
|
-
}
|
|
1567
|
-
}
|
|
1568
|
-
function tokenInHead(p, token) {
|
|
1569
|
-
p.openElements.pop();
|
|
1570
|
-
p.insertionMode = InsertionMode.AFTER_HEAD;
|
|
1571
|
-
p._processToken(token);
|
|
1572
|
-
}
|
|
1573
|
-
// The "in head no script" insertion mode
|
|
1574
|
-
//------------------------------------------------------------------
|
|
1575
|
-
function startTagInHeadNoScript(p, token) {
|
|
1576
|
-
switch (token.tagID) {
|
|
1577
|
-
case html.TAG_ID.HTML:
|
|
1578
|
-
{
|
|
1579
|
-
startTagInBody(p, token);
|
|
1580
|
-
break;
|
|
1581
|
-
}
|
|
1582
|
-
case html.TAG_ID.BASEFONT:
|
|
1583
|
-
case html.TAG_ID.BGSOUND:
|
|
1584
|
-
case html.TAG_ID.HEAD:
|
|
1585
|
-
case html.TAG_ID.LINK:
|
|
1586
|
-
case html.TAG_ID.META:
|
|
1587
|
-
case html.TAG_ID.NOFRAMES:
|
|
1588
|
-
case html.TAG_ID.STYLE:
|
|
1589
|
-
{
|
|
1590
|
-
startTagInHead(p, token);
|
|
1591
|
-
break;
|
|
1592
|
-
}
|
|
1593
|
-
case html.TAG_ID.NOSCRIPT:
|
|
1594
|
-
{
|
|
1595
|
-
p._err(token, errorCodes.ERR.nestedNoscriptInHead);
|
|
1596
|
-
break;
|
|
1597
|
-
}
|
|
1598
|
-
default:
|
|
1599
|
-
{
|
|
1600
|
-
tokenInHeadNoScript(p, token);
|
|
1601
|
-
}
|
|
1602
|
-
}
|
|
1603
|
-
}
|
|
1604
|
-
function endTagInHeadNoScript(p, token) {
|
|
1605
|
-
switch (token.tagID) {
|
|
1606
|
-
case html.TAG_ID.NOSCRIPT:
|
|
1607
|
-
{
|
|
1608
|
-
p.openElements.pop();
|
|
1609
|
-
p.insertionMode = InsertionMode.IN_HEAD;
|
|
1610
|
-
break;
|
|
1611
|
-
}
|
|
1612
|
-
case html.TAG_ID.BR:
|
|
1613
|
-
{
|
|
1614
|
-
tokenInHeadNoScript(p, token);
|
|
1615
|
-
break;
|
|
1616
|
-
}
|
|
1617
|
-
default:
|
|
1618
|
-
{
|
|
1619
|
-
p._err(token, errorCodes.ERR.endTagWithoutMatchingOpenElement);
|
|
1620
|
-
}
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
function tokenInHeadNoScript(p, token$1) {
|
|
1624
|
-
const errCode = token$1.type === token.TokenType.EOF ? errorCodes.ERR.openElementsLeftAfterEof : errorCodes.ERR.disallowedContentInNoscriptInHead;
|
|
1625
|
-
p._err(token$1, errCode);
|
|
1626
|
-
p.openElements.pop();
|
|
1627
|
-
p.insertionMode = InsertionMode.IN_HEAD;
|
|
1628
|
-
p._processToken(token$1);
|
|
1629
|
-
}
|
|
1630
|
-
// The "after head" insertion mode
|
|
1631
|
-
//------------------------------------------------------------------
|
|
1632
|
-
function startTagAfterHead(p, token) {
|
|
1633
|
-
switch (token.tagID) {
|
|
1634
|
-
case html.TAG_ID.HTML:
|
|
1635
|
-
{
|
|
1636
|
-
startTagInBody(p, token);
|
|
1637
|
-
break;
|
|
1638
|
-
}
|
|
1639
|
-
case html.TAG_ID.BODY:
|
|
1640
|
-
{
|
|
1641
|
-
p._insertElement(token, html.NS.HTML);
|
|
1642
|
-
p.framesetOk = false;
|
|
1643
|
-
p.insertionMode = InsertionMode.IN_BODY;
|
|
1644
|
-
break;
|
|
1645
|
-
}
|
|
1646
|
-
case html.TAG_ID.FRAMESET:
|
|
1647
|
-
{
|
|
1648
|
-
p._insertElement(token, html.NS.HTML);
|
|
1649
|
-
p.insertionMode = InsertionMode.IN_FRAMESET;
|
|
1650
|
-
break;
|
|
1651
|
-
}
|
|
1652
|
-
case html.TAG_ID.BASE:
|
|
1653
|
-
case html.TAG_ID.BASEFONT:
|
|
1654
|
-
case html.TAG_ID.BGSOUND:
|
|
1655
|
-
case html.TAG_ID.LINK:
|
|
1656
|
-
case html.TAG_ID.META:
|
|
1657
|
-
case html.TAG_ID.NOFRAMES:
|
|
1658
|
-
case html.TAG_ID.SCRIPT:
|
|
1659
|
-
case html.TAG_ID.STYLE:
|
|
1660
|
-
case html.TAG_ID.TEMPLATE:
|
|
1661
|
-
case html.TAG_ID.TITLE:
|
|
1662
|
-
{
|
|
1663
|
-
p._err(token, errorCodes.ERR.abandonedHeadElementChild);
|
|
1664
|
-
p.openElements.push(p.headElement, html.TAG_ID.HEAD);
|
|
1665
|
-
startTagInHead(p, token);
|
|
1666
|
-
p.openElements.remove(p.headElement);
|
|
1667
|
-
break;
|
|
1668
|
-
}
|
|
1669
|
-
case html.TAG_ID.HEAD:
|
|
1670
|
-
{
|
|
1671
|
-
p._err(token, errorCodes.ERR.misplacedStartTagForHeadElement);
|
|
1672
|
-
break;
|
|
1673
|
-
}
|
|
1674
|
-
default:
|
|
1675
|
-
{
|
|
1676
|
-
tokenAfterHead(p, token);
|
|
1677
|
-
}
|
|
1678
|
-
}
|
|
1679
|
-
}
|
|
1680
|
-
function endTagAfterHead(p, token) {
|
|
1681
|
-
switch (token.tagID) {
|
|
1682
|
-
case html.TAG_ID.BODY:
|
|
1683
|
-
case html.TAG_ID.HTML:
|
|
1684
|
-
case html.TAG_ID.BR:
|
|
1685
|
-
{
|
|
1686
|
-
tokenAfterHead(p, token);
|
|
1687
|
-
break;
|
|
1688
|
-
}
|
|
1689
|
-
case html.TAG_ID.TEMPLATE:
|
|
1690
|
-
{
|
|
1691
|
-
templateEndTagInHead(p, token);
|
|
1692
|
-
break;
|
|
1693
|
-
}
|
|
1694
|
-
default:
|
|
1695
|
-
{
|
|
1696
|
-
p._err(token, errorCodes.ERR.endTagWithoutMatchingOpenElement);
|
|
1697
|
-
}
|
|
1698
|
-
}
|
|
1699
|
-
}
|
|
1700
|
-
function tokenAfterHead(p, token) {
|
|
1701
|
-
p._insertFakeElement(html.TAG_NAMES.BODY, html.TAG_ID.BODY);
|
|
1702
|
-
p.insertionMode = InsertionMode.IN_BODY;
|
|
1703
|
-
modeInBody(p, token);
|
|
1704
|
-
}
|
|
1705
|
-
// The "in body" insertion mode
|
|
1706
|
-
//------------------------------------------------------------------
|
|
1707
|
-
function modeInBody(p, token$1) {
|
|
1708
|
-
switch (token$1.type) {
|
|
1709
|
-
case token.TokenType.CHARACTER:
|
|
1710
|
-
{
|
|
1711
|
-
characterInBody(p, token$1);
|
|
1712
|
-
break;
|
|
1713
|
-
}
|
|
1714
|
-
case token.TokenType.WHITESPACE_CHARACTER:
|
|
1715
|
-
{
|
|
1716
|
-
whitespaceCharacterInBody(p, token$1);
|
|
1717
|
-
break;
|
|
1718
|
-
}
|
|
1719
|
-
case token.TokenType.COMMENT:
|
|
1720
|
-
{
|
|
1721
|
-
appendComment(p, token$1);
|
|
1722
|
-
break;
|
|
1723
|
-
}
|
|
1724
|
-
case token.TokenType.START_TAG:
|
|
1725
|
-
{
|
|
1726
|
-
startTagInBody(p, token$1);
|
|
1727
|
-
break;
|
|
1728
|
-
}
|
|
1729
|
-
case token.TokenType.END_TAG:
|
|
1730
|
-
{
|
|
1731
|
-
endTagInBody(p, token$1);
|
|
1732
|
-
break;
|
|
1733
|
-
}
|
|
1734
|
-
case token.TokenType.EOF:
|
|
1735
|
-
{
|
|
1736
|
-
eofInBody(p, token$1);
|
|
1737
|
-
break;
|
|
1738
|
-
}
|
|
1739
|
-
default:
|
|
1740
|
-
// Do nothing
|
|
1741
|
-
}
|
|
1742
|
-
}
|
|
1743
|
-
function whitespaceCharacterInBody(p, token) {
|
|
1744
|
-
p._reconstructActiveFormattingElements();
|
|
1745
|
-
p._insertCharacters(token);
|
|
1746
|
-
}
|
|
1747
|
-
function characterInBody(p, token) {
|
|
1748
|
-
p._reconstructActiveFormattingElements();
|
|
1749
|
-
p._insertCharacters(token);
|
|
1750
|
-
p.framesetOk = false;
|
|
1751
|
-
}
|
|
1752
|
-
function htmlStartTagInBody(p, token) {
|
|
1753
|
-
if (p.openElements.tmplCount === 0) {
|
|
1754
|
-
p.treeAdapter.adoptAttributes(p.openElements.items[0], token.attrs);
|
|
1755
|
-
}
|
|
1756
|
-
}
|
|
1757
|
-
function bodyStartTagInBody(p, token) {
|
|
1758
|
-
const bodyElement = p.openElements.tryPeekProperlyNestedBodyElement();
|
|
1759
|
-
if (bodyElement && p.openElements.tmplCount === 0) {
|
|
1760
|
-
p.framesetOk = false;
|
|
1761
|
-
p.treeAdapter.adoptAttributes(bodyElement, token.attrs);
|
|
1762
|
-
}
|
|
1763
|
-
}
|
|
1764
|
-
function framesetStartTagInBody(p, token) {
|
|
1765
|
-
const bodyElement = p.openElements.tryPeekProperlyNestedBodyElement();
|
|
1766
|
-
if (p.framesetOk && bodyElement) {
|
|
1767
|
-
p.treeAdapter.detachNode(bodyElement);
|
|
1768
|
-
p.openElements.popAllUpToHtmlElement();
|
|
1769
|
-
p._insertElement(token, html.NS.HTML);
|
|
1770
|
-
p.insertionMode = InsertionMode.IN_FRAMESET;
|
|
1771
|
-
}
|
|
1772
|
-
}
|
|
1773
|
-
function addressStartTagInBody(p, token) {
|
|
1774
|
-
if (p.openElements.hasInButtonScope(html.TAG_ID.P)) {
|
|
1775
|
-
p._closePElement();
|
|
1776
|
-
}
|
|
1777
|
-
p._insertElement(token, html.NS.HTML);
|
|
1778
|
-
}
|
|
1779
|
-
function numberedHeaderStartTagInBody(p, token) {
|
|
1780
|
-
if (p.openElements.hasInButtonScope(html.TAG_ID.P)) {
|
|
1781
|
-
p._closePElement();
|
|
1782
|
-
}
|
|
1783
|
-
if (html.isNumberedHeader(p.openElements.currentTagId)) {
|
|
1784
|
-
p.openElements.pop();
|
|
1785
|
-
}
|
|
1786
|
-
p._insertElement(token, html.NS.HTML);
|
|
1787
|
-
}
|
|
1788
|
-
function preStartTagInBody(p, token) {
|
|
1789
|
-
if (p.openElements.hasInButtonScope(html.TAG_ID.P)) {
|
|
1790
|
-
p._closePElement();
|
|
1791
|
-
}
|
|
1792
|
-
p._insertElement(token, html.NS.HTML);
|
|
1793
|
-
//NOTE: If the next token is a U+000A LINE FEED (LF) character token, then ignore that token and move
|
|
1794
|
-
//on to the next one. (Newlines at the start of pre blocks are ignored as an authoring convenience.)
|
|
1795
|
-
p.skipNextNewLine = true;
|
|
1796
|
-
p.framesetOk = false;
|
|
1797
|
-
}
|
|
1798
|
-
function formStartTagInBody(p, token) {
|
|
1799
|
-
const inTemplate = p.openElements.tmplCount > 0;
|
|
1800
|
-
if (!p.formElement || inTemplate) {
|
|
1801
|
-
if (p.openElements.hasInButtonScope(html.TAG_ID.P)) {
|
|
1802
|
-
p._closePElement();
|
|
1803
|
-
}
|
|
1804
|
-
p._insertElement(token, html.NS.HTML);
|
|
1805
|
-
if (!inTemplate) {
|
|
1806
|
-
p.formElement = p.openElements.current;
|
|
1807
|
-
}
|
|
1808
|
-
}
|
|
1809
|
-
}
|
|
1810
|
-
function listItemStartTagInBody(p, token) {
|
|
1811
|
-
p.framesetOk = false;
|
|
1812
|
-
const tn = token.tagID;
|
|
1813
|
-
for (let i = p.openElements.stackTop; i >= 0; i--) {
|
|
1814
|
-
const elementId = p.openElements.tagIDs[i];
|
|
1815
|
-
if (tn === html.TAG_ID.LI && elementId === html.TAG_ID.LI || (tn === html.TAG_ID.DD || tn === html.TAG_ID.DT) && (elementId === html.TAG_ID.DD || elementId === html.TAG_ID.DT)) {
|
|
1816
|
-
p.openElements.generateImpliedEndTagsWithExclusion(elementId);
|
|
1817
|
-
p.openElements.popUntilTagNamePopped(elementId);
|
|
1818
|
-
break;
|
|
1819
|
-
}
|
|
1820
|
-
if (elementId !== html.TAG_ID.ADDRESS && elementId !== html.TAG_ID.DIV && elementId !== html.TAG_ID.P && p._isSpecialElement(p.openElements.items[i], elementId)) {
|
|
1821
|
-
break;
|
|
1822
|
-
}
|
|
1823
|
-
}
|
|
1824
|
-
if (p.openElements.hasInButtonScope(html.TAG_ID.P)) {
|
|
1825
|
-
p._closePElement();
|
|
1826
|
-
}
|
|
1827
|
-
p._insertElement(token, html.NS.HTML);
|
|
1828
|
-
}
|
|
1829
|
-
function plaintextStartTagInBody(p, token) {
|
|
1830
|
-
if (p.openElements.hasInButtonScope(html.TAG_ID.P)) {
|
|
1831
|
-
p._closePElement();
|
|
1832
|
-
}
|
|
1833
|
-
p._insertElement(token, html.NS.HTML);
|
|
1834
|
-
p.tokenizer.state = index.TokenizerMode.PLAINTEXT;
|
|
1835
|
-
}
|
|
1836
|
-
function buttonStartTagInBody(p, token) {
|
|
1837
|
-
if (p.openElements.hasInScope(html.TAG_ID.BUTTON)) {
|
|
1838
|
-
p.openElements.generateImpliedEndTags();
|
|
1839
|
-
p.openElements.popUntilTagNamePopped(html.TAG_ID.BUTTON);
|
|
1840
|
-
}
|
|
1841
|
-
p._reconstructActiveFormattingElements();
|
|
1842
|
-
p._insertElement(token, html.NS.HTML);
|
|
1843
|
-
p.framesetOk = false;
|
|
1844
|
-
}
|
|
1845
|
-
function aStartTagInBody(p, token) {
|
|
1846
|
-
const activeElementEntry = p.activeFormattingElements.getElementEntryInScopeWithTagName(html.TAG_NAMES.A);
|
|
1847
|
-
if (activeElementEntry) {
|
|
1848
|
-
callAdoptionAgency(p, token);
|
|
1849
|
-
p.openElements.remove(activeElementEntry.element);
|
|
1850
|
-
p.activeFormattingElements.removeEntry(activeElementEntry);
|
|
1851
|
-
}
|
|
1852
|
-
p._reconstructActiveFormattingElements();
|
|
1853
|
-
p._insertElement(token, html.NS.HTML);
|
|
1854
|
-
p.activeFormattingElements.pushElement(p.openElements.current, token);
|
|
1855
|
-
}
|
|
1856
|
-
function bStartTagInBody(p, token) {
|
|
1857
|
-
p._reconstructActiveFormattingElements();
|
|
1858
|
-
p._insertElement(token, html.NS.HTML);
|
|
1859
|
-
p.activeFormattingElements.pushElement(p.openElements.current, token);
|
|
1860
|
-
}
|
|
1861
|
-
function nobrStartTagInBody(p, token) {
|
|
1862
|
-
p._reconstructActiveFormattingElements();
|
|
1863
|
-
if (p.openElements.hasInScope(html.TAG_ID.NOBR)) {
|
|
1864
|
-
callAdoptionAgency(p, token);
|
|
1865
|
-
p._reconstructActiveFormattingElements();
|
|
1866
|
-
}
|
|
1867
|
-
p._insertElement(token, html.NS.HTML);
|
|
1868
|
-
p.activeFormattingElements.pushElement(p.openElements.current, token);
|
|
1869
|
-
}
|
|
1870
|
-
function appletStartTagInBody(p, token) {
|
|
1871
|
-
p._reconstructActiveFormattingElements();
|
|
1872
|
-
p._insertElement(token, html.NS.HTML);
|
|
1873
|
-
p.activeFormattingElements.insertMarker();
|
|
1874
|
-
p.framesetOk = false;
|
|
1875
|
-
}
|
|
1876
|
-
function tableStartTagInBody(p, token) {
|
|
1877
|
-
if (p.treeAdapter.getDocumentMode(p.document) !== html.DOCUMENT_MODE.QUIRKS && p.openElements.hasInButtonScope(html.TAG_ID.P)) {
|
|
1878
|
-
p._closePElement();
|
|
1879
|
-
}
|
|
1880
|
-
p._insertElement(token, html.NS.HTML);
|
|
1881
|
-
p.framesetOk = false;
|
|
1882
|
-
p.insertionMode = InsertionMode.IN_TABLE;
|
|
1883
|
-
}
|
|
1884
|
-
function areaStartTagInBody(p, token) {
|
|
1885
|
-
p._reconstructActiveFormattingElements();
|
|
1886
|
-
p._appendElement(token, html.NS.HTML);
|
|
1887
|
-
p.framesetOk = false;
|
|
1888
|
-
token.ackSelfClosing = true;
|
|
1889
|
-
}
|
|
1890
|
-
function isHiddenInput(token$1) {
|
|
1891
|
-
const inputType = token.getTokenAttr(token$1, html.ATTRS.TYPE);
|
|
1892
|
-
return inputType != null && inputType.toLowerCase() === HIDDEN_INPUT_TYPE;
|
|
1893
|
-
}
|
|
1894
|
-
function inputStartTagInBody(p, token) {
|
|
1895
|
-
p._reconstructActiveFormattingElements();
|
|
1896
|
-
p._appendElement(token, html.NS.HTML);
|
|
1897
|
-
if (!isHiddenInput(token)) {
|
|
1898
|
-
p.framesetOk = false;
|
|
1899
|
-
}
|
|
1900
|
-
token.ackSelfClosing = true;
|
|
1901
|
-
}
|
|
1902
|
-
function paramStartTagInBody(p, token) {
|
|
1903
|
-
p._appendElement(token, html.NS.HTML);
|
|
1904
|
-
token.ackSelfClosing = true;
|
|
1905
|
-
}
|
|
1906
|
-
function hrStartTagInBody(p, token) {
|
|
1907
|
-
if (p.openElements.hasInButtonScope(html.TAG_ID.P)) {
|
|
1908
|
-
p._closePElement();
|
|
1909
|
-
}
|
|
1910
|
-
p._appendElement(token, html.NS.HTML);
|
|
1911
|
-
p.framesetOk = false;
|
|
1912
|
-
token.ackSelfClosing = true;
|
|
1913
|
-
}
|
|
1914
|
-
function imageStartTagInBody(p, token) {
|
|
1915
|
-
token.tagName = html.TAG_NAMES.IMG;
|
|
1916
|
-
token.tagID = html.TAG_ID.IMG;
|
|
1917
|
-
areaStartTagInBody(p, token);
|
|
1918
|
-
}
|
|
1919
|
-
function textareaStartTagInBody(p, token) {
|
|
1920
|
-
p._insertElement(token, html.NS.HTML);
|
|
1921
|
-
//NOTE: If the next token is a U+000A LINE FEED (LF) character token, then ignore that token and move
|
|
1922
|
-
//on to the next one. (Newlines at the start of textarea elements are ignored as an authoring convenience.)
|
|
1923
|
-
p.skipNextNewLine = true;
|
|
1924
|
-
p.tokenizer.state = index.TokenizerMode.RCDATA;
|
|
1925
|
-
p.originalInsertionMode = p.insertionMode;
|
|
1926
|
-
p.framesetOk = false;
|
|
1927
|
-
p.insertionMode = InsertionMode.TEXT;
|
|
1928
|
-
}
|
|
1929
|
-
function xmpStartTagInBody(p, token) {
|
|
1930
|
-
if (p.openElements.hasInButtonScope(html.TAG_ID.P)) {
|
|
1931
|
-
p._closePElement();
|
|
1932
|
-
}
|
|
1933
|
-
p._reconstructActiveFormattingElements();
|
|
1934
|
-
p.framesetOk = false;
|
|
1935
|
-
p._switchToTextParsing(token, index.TokenizerMode.RAWTEXT);
|
|
1936
|
-
}
|
|
1937
|
-
function iframeStartTagInBody(p, token) {
|
|
1938
|
-
p.framesetOk = false;
|
|
1939
|
-
p._switchToTextParsing(token, index.TokenizerMode.RAWTEXT);
|
|
1940
|
-
}
|
|
1941
|
-
//NOTE: here we assume that we always act as an user agent with enabled plugins, so we parse
|
|
1942
|
-
//<noembed> as rawtext.
|
|
1943
|
-
function noembedStartTagInBody(p, token) {
|
|
1944
|
-
p._switchToTextParsing(token, index.TokenizerMode.RAWTEXT);
|
|
1945
|
-
}
|
|
1946
|
-
function selectStartTagInBody(p, token) {
|
|
1947
|
-
p._reconstructActiveFormattingElements();
|
|
1948
|
-
p._insertElement(token, html.NS.HTML);
|
|
1949
|
-
p.framesetOk = false;
|
|
1950
|
-
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;
|
|
1951
|
-
}
|
|
1952
|
-
function optgroupStartTagInBody(p, token) {
|
|
1953
|
-
if (p.openElements.currentTagId === html.TAG_ID.OPTION) {
|
|
1954
|
-
p.openElements.pop();
|
|
1955
|
-
}
|
|
1956
|
-
p._reconstructActiveFormattingElements();
|
|
1957
|
-
p._insertElement(token, html.NS.HTML);
|
|
1958
|
-
}
|
|
1959
|
-
function rbStartTagInBody(p, token) {
|
|
1960
|
-
if (p.openElements.hasInScope(html.TAG_ID.RUBY)) {
|
|
1961
|
-
p.openElements.generateImpliedEndTags();
|
|
1962
|
-
}
|
|
1963
|
-
p._insertElement(token, html.NS.HTML);
|
|
1964
|
-
}
|
|
1965
|
-
function rtStartTagInBody(p, token) {
|
|
1966
|
-
if (p.openElements.hasInScope(html.TAG_ID.RUBY)) {
|
|
1967
|
-
p.openElements.generateImpliedEndTagsWithExclusion(html.TAG_ID.RTC);
|
|
1968
|
-
}
|
|
1969
|
-
p._insertElement(token, html.NS.HTML);
|
|
1970
|
-
}
|
|
1971
|
-
function mathStartTagInBody(p, token) {
|
|
1972
|
-
p._reconstructActiveFormattingElements();
|
|
1973
|
-
foreignContent.adjustTokenMathMLAttrs(token);
|
|
1974
|
-
foreignContent.adjustTokenXMLAttrs(token);
|
|
1975
|
-
if (token.selfClosing) {
|
|
1976
|
-
p._appendElement(token, html.NS.MATHML);
|
|
1977
|
-
} else {
|
|
1978
|
-
p._insertElement(token, html.NS.MATHML);
|
|
1979
|
-
}
|
|
1980
|
-
token.ackSelfClosing = true;
|
|
1981
|
-
}
|
|
1982
|
-
function svgStartTagInBody(p, token) {
|
|
1983
|
-
p._reconstructActiveFormattingElements();
|
|
1984
|
-
foreignContent.adjustTokenSVGAttrs(token);
|
|
1985
|
-
foreignContent.adjustTokenXMLAttrs(token);
|
|
1986
|
-
if (token.selfClosing) {
|
|
1987
|
-
p._appendElement(token, html.NS.SVG);
|
|
1988
|
-
} else {
|
|
1989
|
-
p._insertElement(token, html.NS.SVG);
|
|
1990
|
-
}
|
|
1991
|
-
token.ackSelfClosing = true;
|
|
1992
|
-
}
|
|
1993
|
-
function genericStartTagInBody(p, token) {
|
|
1994
|
-
p._reconstructActiveFormattingElements();
|
|
1995
|
-
p._insertElement(token, html.NS.HTML);
|
|
1996
|
-
}
|
|
1997
|
-
function startTagInBody(p, token) {
|
|
1998
|
-
switch (token.tagID) {
|
|
1999
|
-
case html.TAG_ID.I:
|
|
2000
|
-
case html.TAG_ID.S:
|
|
2001
|
-
case html.TAG_ID.B:
|
|
2002
|
-
case html.TAG_ID.U:
|
|
2003
|
-
case html.TAG_ID.EM:
|
|
2004
|
-
case html.TAG_ID.TT:
|
|
2005
|
-
case html.TAG_ID.BIG:
|
|
2006
|
-
case html.TAG_ID.CODE:
|
|
2007
|
-
case html.TAG_ID.FONT:
|
|
2008
|
-
case html.TAG_ID.SMALL:
|
|
2009
|
-
case html.TAG_ID.STRIKE:
|
|
2010
|
-
case html.TAG_ID.STRONG:
|
|
2011
|
-
{
|
|
2012
|
-
bStartTagInBody(p, token);
|
|
2013
|
-
break;
|
|
2014
|
-
}
|
|
2015
|
-
case html.TAG_ID.A:
|
|
2016
|
-
{
|
|
2017
|
-
aStartTagInBody(p, token);
|
|
2018
|
-
break;
|
|
2019
|
-
}
|
|
2020
|
-
case html.TAG_ID.H1:
|
|
2021
|
-
case html.TAG_ID.H2:
|
|
2022
|
-
case html.TAG_ID.H3:
|
|
2023
|
-
case html.TAG_ID.H4:
|
|
2024
|
-
case html.TAG_ID.H5:
|
|
2025
|
-
case html.TAG_ID.H6:
|
|
2026
|
-
{
|
|
2027
|
-
numberedHeaderStartTagInBody(p, token);
|
|
2028
|
-
break;
|
|
2029
|
-
}
|
|
2030
|
-
case html.TAG_ID.P:
|
|
2031
|
-
case html.TAG_ID.DL:
|
|
2032
|
-
case html.TAG_ID.OL:
|
|
2033
|
-
case html.TAG_ID.UL:
|
|
2034
|
-
case html.TAG_ID.DIV:
|
|
2035
|
-
case html.TAG_ID.DIR:
|
|
2036
|
-
case html.TAG_ID.NAV:
|
|
2037
|
-
case html.TAG_ID.MAIN:
|
|
2038
|
-
case html.TAG_ID.MENU:
|
|
2039
|
-
case html.TAG_ID.ASIDE:
|
|
2040
|
-
case html.TAG_ID.CENTER:
|
|
2041
|
-
case html.TAG_ID.FIGURE:
|
|
2042
|
-
case html.TAG_ID.FOOTER:
|
|
2043
|
-
case html.TAG_ID.HEADER:
|
|
2044
|
-
case html.TAG_ID.HGROUP:
|
|
2045
|
-
case html.TAG_ID.DIALOG:
|
|
2046
|
-
case html.TAG_ID.DETAILS:
|
|
2047
|
-
case html.TAG_ID.ADDRESS:
|
|
2048
|
-
case html.TAG_ID.ARTICLE:
|
|
2049
|
-
case html.TAG_ID.SECTION:
|
|
2050
|
-
case html.TAG_ID.SUMMARY:
|
|
2051
|
-
case html.TAG_ID.FIELDSET:
|
|
2052
|
-
case html.TAG_ID.BLOCKQUOTE:
|
|
2053
|
-
case html.TAG_ID.FIGCAPTION:
|
|
2054
|
-
{
|
|
2055
|
-
addressStartTagInBody(p, token);
|
|
2056
|
-
break;
|
|
2057
|
-
}
|
|
2058
|
-
case html.TAG_ID.LI:
|
|
2059
|
-
case html.TAG_ID.DD:
|
|
2060
|
-
case html.TAG_ID.DT:
|
|
2061
|
-
{
|
|
2062
|
-
listItemStartTagInBody(p, token);
|
|
2063
|
-
break;
|
|
2064
|
-
}
|
|
2065
|
-
case html.TAG_ID.BR:
|
|
2066
|
-
case html.TAG_ID.IMG:
|
|
2067
|
-
case html.TAG_ID.WBR:
|
|
2068
|
-
case html.TAG_ID.AREA:
|
|
2069
|
-
case html.TAG_ID.EMBED:
|
|
2070
|
-
case html.TAG_ID.KEYGEN:
|
|
2071
|
-
{
|
|
2072
|
-
areaStartTagInBody(p, token);
|
|
2073
|
-
break;
|
|
2074
|
-
}
|
|
2075
|
-
case html.TAG_ID.HR:
|
|
2076
|
-
{
|
|
2077
|
-
hrStartTagInBody(p, token);
|
|
2078
|
-
break;
|
|
2079
|
-
}
|
|
2080
|
-
case html.TAG_ID.RB:
|
|
2081
|
-
case html.TAG_ID.RTC:
|
|
2082
|
-
{
|
|
2083
|
-
rbStartTagInBody(p, token);
|
|
2084
|
-
break;
|
|
2085
|
-
}
|
|
2086
|
-
case html.TAG_ID.RT:
|
|
2087
|
-
case html.TAG_ID.RP:
|
|
2088
|
-
{
|
|
2089
|
-
rtStartTagInBody(p, token);
|
|
2090
|
-
break;
|
|
2091
|
-
}
|
|
2092
|
-
case html.TAG_ID.PRE:
|
|
2093
|
-
case html.TAG_ID.LISTING:
|
|
2094
|
-
{
|
|
2095
|
-
preStartTagInBody(p, token);
|
|
2096
|
-
break;
|
|
2097
|
-
}
|
|
2098
|
-
case html.TAG_ID.XMP:
|
|
2099
|
-
{
|
|
2100
|
-
xmpStartTagInBody(p, token);
|
|
2101
|
-
break;
|
|
2102
|
-
}
|
|
2103
|
-
case html.TAG_ID.SVG:
|
|
2104
|
-
{
|
|
2105
|
-
svgStartTagInBody(p, token);
|
|
2106
|
-
break;
|
|
2107
|
-
}
|
|
2108
|
-
case html.TAG_ID.HTML:
|
|
2109
|
-
{
|
|
2110
|
-
htmlStartTagInBody(p, token);
|
|
2111
|
-
break;
|
|
2112
|
-
}
|
|
2113
|
-
case html.TAG_ID.BASE:
|
|
2114
|
-
case html.TAG_ID.LINK:
|
|
2115
|
-
case html.TAG_ID.META:
|
|
2116
|
-
case html.TAG_ID.STYLE:
|
|
2117
|
-
case html.TAG_ID.TITLE:
|
|
2118
|
-
case html.TAG_ID.SCRIPT:
|
|
2119
|
-
case html.TAG_ID.BGSOUND:
|
|
2120
|
-
case html.TAG_ID.BASEFONT:
|
|
2121
|
-
case html.TAG_ID.TEMPLATE:
|
|
2122
|
-
{
|
|
2123
|
-
startTagInHead(p, token);
|
|
2124
|
-
break;
|
|
2125
|
-
}
|
|
2126
|
-
case html.TAG_ID.BODY:
|
|
2127
|
-
{
|
|
2128
|
-
bodyStartTagInBody(p, token);
|
|
2129
|
-
break;
|
|
2130
|
-
}
|
|
2131
|
-
case html.TAG_ID.FORM:
|
|
2132
|
-
{
|
|
2133
|
-
formStartTagInBody(p, token);
|
|
2134
|
-
break;
|
|
2135
|
-
}
|
|
2136
|
-
case html.TAG_ID.NOBR:
|
|
2137
|
-
{
|
|
2138
|
-
nobrStartTagInBody(p, token);
|
|
2139
|
-
break;
|
|
2140
|
-
}
|
|
2141
|
-
case html.TAG_ID.MATH:
|
|
2142
|
-
{
|
|
2143
|
-
mathStartTagInBody(p, token);
|
|
2144
|
-
break;
|
|
2145
|
-
}
|
|
2146
|
-
case html.TAG_ID.TABLE:
|
|
2147
|
-
{
|
|
2148
|
-
tableStartTagInBody(p, token);
|
|
2149
|
-
break;
|
|
2150
|
-
}
|
|
2151
|
-
case html.TAG_ID.INPUT:
|
|
2152
|
-
{
|
|
2153
|
-
inputStartTagInBody(p, token);
|
|
2154
|
-
break;
|
|
2155
|
-
}
|
|
2156
|
-
case html.TAG_ID.PARAM:
|
|
2157
|
-
case html.TAG_ID.TRACK:
|
|
2158
|
-
case html.TAG_ID.SOURCE:
|
|
2159
|
-
{
|
|
2160
|
-
paramStartTagInBody(p, token);
|
|
2161
|
-
break;
|
|
2162
|
-
}
|
|
2163
|
-
case html.TAG_ID.IMAGE:
|
|
2164
|
-
{
|
|
2165
|
-
imageStartTagInBody(p, token);
|
|
2166
|
-
break;
|
|
2167
|
-
}
|
|
2168
|
-
case html.TAG_ID.BUTTON:
|
|
2169
|
-
{
|
|
2170
|
-
buttonStartTagInBody(p, token);
|
|
2171
|
-
break;
|
|
2172
|
-
}
|
|
2173
|
-
case html.TAG_ID.APPLET:
|
|
2174
|
-
case html.TAG_ID.OBJECT:
|
|
2175
|
-
case html.TAG_ID.MARQUEE:
|
|
2176
|
-
{
|
|
2177
|
-
appletStartTagInBody(p, token);
|
|
2178
|
-
break;
|
|
2179
|
-
}
|
|
2180
|
-
case html.TAG_ID.IFRAME:
|
|
2181
|
-
{
|
|
2182
|
-
iframeStartTagInBody(p, token);
|
|
2183
|
-
break;
|
|
2184
|
-
}
|
|
2185
|
-
case html.TAG_ID.SELECT:
|
|
2186
|
-
{
|
|
2187
|
-
selectStartTagInBody(p, token);
|
|
2188
|
-
break;
|
|
2189
|
-
}
|
|
2190
|
-
case html.TAG_ID.OPTION:
|
|
2191
|
-
case html.TAG_ID.OPTGROUP:
|
|
2192
|
-
{
|
|
2193
|
-
optgroupStartTagInBody(p, token);
|
|
2194
|
-
break;
|
|
2195
|
-
}
|
|
2196
|
-
case html.TAG_ID.NOEMBED:
|
|
2197
|
-
{
|
|
2198
|
-
noembedStartTagInBody(p, token);
|
|
2199
|
-
break;
|
|
2200
|
-
}
|
|
2201
|
-
case html.TAG_ID.FRAMESET:
|
|
2202
|
-
{
|
|
2203
|
-
framesetStartTagInBody(p, token);
|
|
2204
|
-
break;
|
|
2205
|
-
}
|
|
2206
|
-
case html.TAG_ID.TEXTAREA:
|
|
2207
|
-
{
|
|
2208
|
-
textareaStartTagInBody(p, token);
|
|
2209
|
-
break;
|
|
2210
|
-
}
|
|
2211
|
-
case html.TAG_ID.NOSCRIPT:
|
|
2212
|
-
{
|
|
2213
|
-
if (p.options.scriptingEnabled) {
|
|
2214
|
-
noembedStartTagInBody(p, token);
|
|
2215
|
-
} else {
|
|
2216
|
-
genericStartTagInBody(p, token);
|
|
2217
|
-
}
|
|
2218
|
-
break;
|
|
2219
|
-
}
|
|
2220
|
-
case html.TAG_ID.PLAINTEXT:
|
|
2221
|
-
{
|
|
2222
|
-
plaintextStartTagInBody(p, token);
|
|
2223
|
-
break;
|
|
2224
|
-
}
|
|
2225
|
-
case html.TAG_ID.COL:
|
|
2226
|
-
case html.TAG_ID.TH:
|
|
2227
|
-
case html.TAG_ID.TD:
|
|
2228
|
-
case html.TAG_ID.TR:
|
|
2229
|
-
case html.TAG_ID.HEAD:
|
|
2230
|
-
case html.TAG_ID.FRAME:
|
|
2231
|
-
case html.TAG_ID.TBODY:
|
|
2232
|
-
case html.TAG_ID.TFOOT:
|
|
2233
|
-
case html.TAG_ID.THEAD:
|
|
2234
|
-
case html.TAG_ID.CAPTION:
|
|
2235
|
-
case html.TAG_ID.COLGROUP:
|
|
2236
|
-
{
|
|
2237
|
-
// Ignore token
|
|
2238
|
-
break;
|
|
2239
|
-
}
|
|
2240
|
-
default:
|
|
2241
|
-
{
|
|
2242
|
-
genericStartTagInBody(p, token);
|
|
2243
|
-
}
|
|
2244
|
-
}
|
|
2245
|
-
}
|
|
2246
|
-
function bodyEndTagInBody(p, token) {
|
|
2247
|
-
if (p.openElements.hasInScope(html.TAG_ID.BODY)) {
|
|
2248
|
-
p.insertionMode = InsertionMode.AFTER_BODY;
|
|
2249
|
-
//NOTE: <body> is never popped from the stack, so we need to updated
|
|
2250
|
-
//the end location explicitly.
|
|
2251
|
-
if (p.options.sourceCodeLocationInfo) {
|
|
2252
|
-
const bodyElement = p.openElements.tryPeekProperlyNestedBodyElement();
|
|
2253
|
-
if (bodyElement) {
|
|
2254
|
-
p._setEndLocation(bodyElement, token);
|
|
2255
|
-
}
|
|
2256
|
-
}
|
|
2257
|
-
}
|
|
2258
|
-
}
|
|
2259
|
-
function htmlEndTagInBody(p, token) {
|
|
2260
|
-
if (p.openElements.hasInScope(html.TAG_ID.BODY)) {
|
|
2261
|
-
p.insertionMode = InsertionMode.AFTER_BODY;
|
|
2262
|
-
endTagAfterBody(p, token);
|
|
2263
|
-
}
|
|
2264
|
-
}
|
|
2265
|
-
function addressEndTagInBody(p, token) {
|
|
2266
|
-
const tn = token.tagID;
|
|
2267
|
-
if (p.openElements.hasInScope(tn)) {
|
|
2268
|
-
p.openElements.generateImpliedEndTags();
|
|
2269
|
-
p.openElements.popUntilTagNamePopped(tn);
|
|
2270
|
-
}
|
|
2271
|
-
}
|
|
2272
|
-
function formEndTagInBody(p) {
|
|
2273
|
-
const inTemplate = p.openElements.tmplCount > 0;
|
|
2274
|
-
const formElement = p.formElement;
|
|
2275
|
-
if (!inTemplate) {
|
|
2276
|
-
p.formElement = null;
|
|
2277
|
-
}
|
|
2278
|
-
if ((formElement || inTemplate) && p.openElements.hasInScope(html.TAG_ID.FORM)) {
|
|
2279
|
-
p.openElements.generateImpliedEndTags();
|
|
2280
|
-
if (inTemplate) {
|
|
2281
|
-
p.openElements.popUntilTagNamePopped(html.TAG_ID.FORM);
|
|
2282
|
-
} else if (formElement) {
|
|
2283
|
-
p.openElements.remove(formElement);
|
|
2284
|
-
}
|
|
2285
|
-
}
|
|
2286
|
-
}
|
|
2287
|
-
function pEndTagInBody(p) {
|
|
2288
|
-
if (!p.openElements.hasInButtonScope(html.TAG_ID.P)) {
|
|
2289
|
-
p._insertFakeElement(html.TAG_NAMES.P, html.TAG_ID.P);
|
|
2290
|
-
}
|
|
2291
|
-
p._closePElement();
|
|
2292
|
-
}
|
|
2293
|
-
function liEndTagInBody(p) {
|
|
2294
|
-
if (p.openElements.hasInListItemScope(html.TAG_ID.LI)) {
|
|
2295
|
-
p.openElements.generateImpliedEndTagsWithExclusion(html.TAG_ID.LI);
|
|
2296
|
-
p.openElements.popUntilTagNamePopped(html.TAG_ID.LI);
|
|
2297
|
-
}
|
|
2298
|
-
}
|
|
2299
|
-
function ddEndTagInBody(p, token) {
|
|
2300
|
-
const tn = token.tagID;
|
|
2301
|
-
if (p.openElements.hasInScope(tn)) {
|
|
2302
|
-
p.openElements.generateImpliedEndTagsWithExclusion(tn);
|
|
2303
|
-
p.openElements.popUntilTagNamePopped(tn);
|
|
2304
|
-
}
|
|
2305
|
-
}
|
|
2306
|
-
function numberedHeaderEndTagInBody(p) {
|
|
2307
|
-
if (p.openElements.hasNumberedHeaderInScope()) {
|
|
2308
|
-
p.openElements.generateImpliedEndTags();
|
|
2309
|
-
p.openElements.popUntilNumberedHeaderPopped();
|
|
2310
|
-
}
|
|
2311
|
-
}
|
|
2312
|
-
function appletEndTagInBody(p, token) {
|
|
2313
|
-
const tn = token.tagID;
|
|
2314
|
-
if (p.openElements.hasInScope(tn)) {
|
|
2315
|
-
p.openElements.generateImpliedEndTags();
|
|
2316
|
-
p.openElements.popUntilTagNamePopped(tn);
|
|
2317
|
-
p.activeFormattingElements.clearToLastMarker();
|
|
2318
|
-
}
|
|
2319
|
-
}
|
|
2320
|
-
function brEndTagInBody(p) {
|
|
2321
|
-
p._reconstructActiveFormattingElements();
|
|
2322
|
-
p._insertFakeElement(html.TAG_NAMES.BR, html.TAG_ID.BR);
|
|
2323
|
-
p.openElements.pop();
|
|
2324
|
-
p.framesetOk = false;
|
|
2325
|
-
}
|
|
2326
|
-
function genericEndTagInBody(p, token) {
|
|
2327
|
-
const tn = token.tagName;
|
|
2328
|
-
const tid = token.tagID;
|
|
2329
|
-
for (let i = p.openElements.stackTop; i > 0; i--) {
|
|
2330
|
-
const element = p.openElements.items[i];
|
|
2331
|
-
const elementId = p.openElements.tagIDs[i];
|
|
2332
|
-
// Compare the tag name here, as the tag might not be a known tag with an ID.
|
|
2333
|
-
if (tid === elementId && (tid !== html.TAG_ID.UNKNOWN || p.treeAdapter.getTagName(element) === tn)) {
|
|
2334
|
-
p.openElements.generateImpliedEndTagsWithExclusion(tid);
|
|
2335
|
-
if (p.openElements.stackTop >= i) p.openElements.shortenToLength(i);
|
|
2336
|
-
break;
|
|
2337
|
-
}
|
|
2338
|
-
if (p._isSpecialElement(element, elementId)) {
|
|
2339
|
-
break;
|
|
2340
|
-
}
|
|
2341
|
-
}
|
|
2342
|
-
}
|
|
2343
|
-
function endTagInBody(p, token) {
|
|
2344
|
-
switch (token.tagID) {
|
|
2345
|
-
case html.TAG_ID.A:
|
|
2346
|
-
case html.TAG_ID.B:
|
|
2347
|
-
case html.TAG_ID.I:
|
|
2348
|
-
case html.TAG_ID.S:
|
|
2349
|
-
case html.TAG_ID.U:
|
|
2350
|
-
case html.TAG_ID.EM:
|
|
2351
|
-
case html.TAG_ID.TT:
|
|
2352
|
-
case html.TAG_ID.BIG:
|
|
2353
|
-
case html.TAG_ID.CODE:
|
|
2354
|
-
case html.TAG_ID.FONT:
|
|
2355
|
-
case html.TAG_ID.NOBR:
|
|
2356
|
-
case html.TAG_ID.SMALL:
|
|
2357
|
-
case html.TAG_ID.STRIKE:
|
|
2358
|
-
case html.TAG_ID.STRONG:
|
|
2359
|
-
{
|
|
2360
|
-
callAdoptionAgency(p, token);
|
|
2361
|
-
break;
|
|
2362
|
-
}
|
|
2363
|
-
case html.TAG_ID.P:
|
|
2364
|
-
{
|
|
2365
|
-
pEndTagInBody(p);
|
|
2366
|
-
break;
|
|
2367
|
-
}
|
|
2368
|
-
case html.TAG_ID.DL:
|
|
2369
|
-
case html.TAG_ID.UL:
|
|
2370
|
-
case html.TAG_ID.OL:
|
|
2371
|
-
case html.TAG_ID.DIR:
|
|
2372
|
-
case html.TAG_ID.DIV:
|
|
2373
|
-
case html.TAG_ID.NAV:
|
|
2374
|
-
case html.TAG_ID.PRE:
|
|
2375
|
-
case html.TAG_ID.MAIN:
|
|
2376
|
-
case html.TAG_ID.MENU:
|
|
2377
|
-
case html.TAG_ID.ASIDE:
|
|
2378
|
-
case html.TAG_ID.BUTTON:
|
|
2379
|
-
case html.TAG_ID.CENTER:
|
|
2380
|
-
case html.TAG_ID.FIGURE:
|
|
2381
|
-
case html.TAG_ID.FOOTER:
|
|
2382
|
-
case html.TAG_ID.HEADER:
|
|
2383
|
-
case html.TAG_ID.HGROUP:
|
|
2384
|
-
case html.TAG_ID.DIALOG:
|
|
2385
|
-
case html.TAG_ID.ADDRESS:
|
|
2386
|
-
case html.TAG_ID.ARTICLE:
|
|
2387
|
-
case html.TAG_ID.DETAILS:
|
|
2388
|
-
case html.TAG_ID.SECTION:
|
|
2389
|
-
case html.TAG_ID.SUMMARY:
|
|
2390
|
-
case html.TAG_ID.LISTING:
|
|
2391
|
-
case html.TAG_ID.FIELDSET:
|
|
2392
|
-
case html.TAG_ID.BLOCKQUOTE:
|
|
2393
|
-
case html.TAG_ID.FIGCAPTION:
|
|
2394
|
-
{
|
|
2395
|
-
addressEndTagInBody(p, token);
|
|
2396
|
-
break;
|
|
2397
|
-
}
|
|
2398
|
-
case html.TAG_ID.LI:
|
|
2399
|
-
{
|
|
2400
|
-
liEndTagInBody(p);
|
|
2401
|
-
break;
|
|
2402
|
-
}
|
|
2403
|
-
case html.TAG_ID.DD:
|
|
2404
|
-
case html.TAG_ID.DT:
|
|
2405
|
-
{
|
|
2406
|
-
ddEndTagInBody(p, token);
|
|
2407
|
-
break;
|
|
2408
|
-
}
|
|
2409
|
-
case html.TAG_ID.H1:
|
|
2410
|
-
case html.TAG_ID.H2:
|
|
2411
|
-
case html.TAG_ID.H3:
|
|
2412
|
-
case html.TAG_ID.H4:
|
|
2413
|
-
case html.TAG_ID.H5:
|
|
2414
|
-
case html.TAG_ID.H6:
|
|
2415
|
-
{
|
|
2416
|
-
numberedHeaderEndTagInBody(p);
|
|
2417
|
-
break;
|
|
2418
|
-
}
|
|
2419
|
-
case html.TAG_ID.BR:
|
|
2420
|
-
{
|
|
2421
|
-
brEndTagInBody(p);
|
|
2422
|
-
break;
|
|
2423
|
-
}
|
|
2424
|
-
case html.TAG_ID.BODY:
|
|
2425
|
-
{
|
|
2426
|
-
bodyEndTagInBody(p, token);
|
|
2427
|
-
break;
|
|
2428
|
-
}
|
|
2429
|
-
case html.TAG_ID.HTML:
|
|
2430
|
-
{
|
|
2431
|
-
htmlEndTagInBody(p, token);
|
|
2432
|
-
break;
|
|
2433
|
-
}
|
|
2434
|
-
case html.TAG_ID.FORM:
|
|
2435
|
-
{
|
|
2436
|
-
formEndTagInBody(p);
|
|
2437
|
-
break;
|
|
2438
|
-
}
|
|
2439
|
-
case html.TAG_ID.APPLET:
|
|
2440
|
-
case html.TAG_ID.OBJECT:
|
|
2441
|
-
case html.TAG_ID.MARQUEE:
|
|
2442
|
-
{
|
|
2443
|
-
appletEndTagInBody(p, token);
|
|
2444
|
-
break;
|
|
2445
|
-
}
|
|
2446
|
-
case html.TAG_ID.TEMPLATE:
|
|
2447
|
-
{
|
|
2448
|
-
templateEndTagInHead(p, token);
|
|
2449
|
-
break;
|
|
2450
|
-
}
|
|
2451
|
-
default:
|
|
2452
|
-
{
|
|
2453
|
-
genericEndTagInBody(p, token);
|
|
2454
|
-
}
|
|
2455
|
-
}
|
|
2456
|
-
}
|
|
2457
|
-
function eofInBody(p, token) {
|
|
2458
|
-
if (p.tmplInsertionModeStack.length > 0) {
|
|
2459
|
-
eofInTemplate(p, token);
|
|
2460
|
-
} else {
|
|
2461
|
-
stopParsing(p, token);
|
|
2462
|
-
}
|
|
2463
|
-
}
|
|
2464
|
-
// The "text" insertion mode
|
|
2465
|
-
//------------------------------------------------------------------
|
|
2466
|
-
function endTagInText(p, token) {
|
|
2467
|
-
var _a;
|
|
2468
|
-
if (token.tagID === html.TAG_ID.SCRIPT) {
|
|
2469
|
-
(_a = p.scriptHandler) === null || _a === void 0 ? void 0 : _a.call(p, p.openElements.current);
|
|
2470
|
-
}
|
|
2471
|
-
p.openElements.pop();
|
|
2472
|
-
p.insertionMode = p.originalInsertionMode;
|
|
2473
|
-
}
|
|
2474
|
-
function eofInText(p, token) {
|
|
2475
|
-
p._err(token, errorCodes.ERR.eofInElementThatCanContainOnlyText);
|
|
2476
|
-
p.openElements.pop();
|
|
2477
|
-
p.insertionMode = p.originalInsertionMode;
|
|
2478
|
-
p.onEof(token);
|
|
2479
|
-
}
|
|
2480
|
-
// The "in table" insertion mode
|
|
2481
|
-
//------------------------------------------------------------------
|
|
2482
|
-
function characterInTable(p, token$1) {
|
|
2483
|
-
if (TABLE_STRUCTURE_TAGS.has(p.openElements.currentTagId)) {
|
|
2484
|
-
p.pendingCharacterTokens.length = 0;
|
|
2485
|
-
p.hasNonWhitespacePendingCharacterToken = false;
|
|
2486
|
-
p.originalInsertionMode = p.insertionMode;
|
|
2487
|
-
p.insertionMode = InsertionMode.IN_TABLE_TEXT;
|
|
2488
|
-
switch (token$1.type) {
|
|
2489
|
-
case token.TokenType.CHARACTER:
|
|
2490
|
-
{
|
|
2491
|
-
characterInTableText(p, token$1);
|
|
2492
|
-
break;
|
|
2493
|
-
}
|
|
2494
|
-
case token.TokenType.WHITESPACE_CHARACTER:
|
|
2495
|
-
{
|
|
2496
|
-
whitespaceCharacterInTableText(p, token$1);
|
|
2497
|
-
break;
|
|
2498
|
-
}
|
|
2499
|
-
// Ignore null
|
|
2500
|
-
}
|
|
2501
|
-
} else {
|
|
2502
|
-
tokenInTable(p, token$1);
|
|
2503
|
-
}
|
|
2504
|
-
}
|
|
2505
|
-
function captionStartTagInTable(p, token) {
|
|
2506
|
-
p.openElements.clearBackToTableContext();
|
|
2507
|
-
p.activeFormattingElements.insertMarker();
|
|
2508
|
-
p._insertElement(token, html.NS.HTML);
|
|
2509
|
-
p.insertionMode = InsertionMode.IN_CAPTION;
|
|
2510
|
-
}
|
|
2511
|
-
function colgroupStartTagInTable(p, token) {
|
|
2512
|
-
p.openElements.clearBackToTableContext();
|
|
2513
|
-
p._insertElement(token, html.NS.HTML);
|
|
2514
|
-
p.insertionMode = InsertionMode.IN_COLUMN_GROUP;
|
|
2515
|
-
}
|
|
2516
|
-
function colStartTagInTable(p, token) {
|
|
2517
|
-
p.openElements.clearBackToTableContext();
|
|
2518
|
-
p._insertFakeElement(html.TAG_NAMES.COLGROUP, html.TAG_ID.COLGROUP);
|
|
2519
|
-
p.insertionMode = InsertionMode.IN_COLUMN_GROUP;
|
|
2520
|
-
startTagInColumnGroup(p, token);
|
|
2521
|
-
}
|
|
2522
|
-
function tbodyStartTagInTable(p, token) {
|
|
2523
|
-
p.openElements.clearBackToTableContext();
|
|
2524
|
-
p._insertElement(token, html.NS.HTML);
|
|
2525
|
-
p.insertionMode = InsertionMode.IN_TABLE_BODY;
|
|
2526
|
-
}
|
|
2527
|
-
function tdStartTagInTable(p, token) {
|
|
2528
|
-
p.openElements.clearBackToTableContext();
|
|
2529
|
-
p._insertFakeElement(html.TAG_NAMES.TBODY, html.TAG_ID.TBODY);
|
|
2530
|
-
p.insertionMode = InsertionMode.IN_TABLE_BODY;
|
|
2531
|
-
startTagInTableBody(p, token);
|
|
2532
|
-
}
|
|
2533
|
-
function tableStartTagInTable(p, token) {
|
|
2534
|
-
if (p.openElements.hasInTableScope(html.TAG_ID.TABLE)) {
|
|
2535
|
-
p.openElements.popUntilTagNamePopped(html.TAG_ID.TABLE);
|
|
2536
|
-
p._resetInsertionMode();
|
|
2537
|
-
p._processStartTag(token);
|
|
2538
|
-
}
|
|
2539
|
-
}
|
|
2540
|
-
function inputStartTagInTable(p, token) {
|
|
2541
|
-
if (isHiddenInput(token)) {
|
|
2542
|
-
p._appendElement(token, html.NS.HTML);
|
|
2543
|
-
} else {
|
|
2544
|
-
tokenInTable(p, token);
|
|
2545
|
-
}
|
|
2546
|
-
token.ackSelfClosing = true;
|
|
2547
|
-
}
|
|
2548
|
-
function formStartTagInTable(p, token) {
|
|
2549
|
-
if (!p.formElement && p.openElements.tmplCount === 0) {
|
|
2550
|
-
p._insertElement(token, html.NS.HTML);
|
|
2551
|
-
p.formElement = p.openElements.current;
|
|
2552
|
-
p.openElements.pop();
|
|
2553
|
-
}
|
|
2554
|
-
}
|
|
2555
|
-
function startTagInTable(p, token) {
|
|
2556
|
-
switch (token.tagID) {
|
|
2557
|
-
case html.TAG_ID.TD:
|
|
2558
|
-
case html.TAG_ID.TH:
|
|
2559
|
-
case html.TAG_ID.TR:
|
|
2560
|
-
{
|
|
2561
|
-
tdStartTagInTable(p, token);
|
|
2562
|
-
break;
|
|
2563
|
-
}
|
|
2564
|
-
case html.TAG_ID.STYLE:
|
|
2565
|
-
case html.TAG_ID.SCRIPT:
|
|
2566
|
-
case html.TAG_ID.TEMPLATE:
|
|
2567
|
-
{
|
|
2568
|
-
startTagInHead(p, token);
|
|
2569
|
-
break;
|
|
2570
|
-
}
|
|
2571
|
-
case html.TAG_ID.COL:
|
|
2572
|
-
{
|
|
2573
|
-
colStartTagInTable(p, token);
|
|
2574
|
-
break;
|
|
2575
|
-
}
|
|
2576
|
-
case html.TAG_ID.FORM:
|
|
2577
|
-
{
|
|
2578
|
-
formStartTagInTable(p, token);
|
|
2579
|
-
break;
|
|
2580
|
-
}
|
|
2581
|
-
case html.TAG_ID.TABLE:
|
|
2582
|
-
{
|
|
2583
|
-
tableStartTagInTable(p, token);
|
|
2584
|
-
break;
|
|
2585
|
-
}
|
|
2586
|
-
case html.TAG_ID.TBODY:
|
|
2587
|
-
case html.TAG_ID.TFOOT:
|
|
2588
|
-
case html.TAG_ID.THEAD:
|
|
2589
|
-
{
|
|
2590
|
-
tbodyStartTagInTable(p, token);
|
|
2591
|
-
break;
|
|
2592
|
-
}
|
|
2593
|
-
case html.TAG_ID.INPUT:
|
|
2594
|
-
{
|
|
2595
|
-
inputStartTagInTable(p, token);
|
|
2596
|
-
break;
|
|
2597
|
-
}
|
|
2598
|
-
case html.TAG_ID.CAPTION:
|
|
2599
|
-
{
|
|
2600
|
-
captionStartTagInTable(p, token);
|
|
2601
|
-
break;
|
|
2602
|
-
}
|
|
2603
|
-
case html.TAG_ID.COLGROUP:
|
|
2604
|
-
{
|
|
2605
|
-
colgroupStartTagInTable(p, token);
|
|
2606
|
-
break;
|
|
2607
|
-
}
|
|
2608
|
-
default:
|
|
2609
|
-
{
|
|
2610
|
-
tokenInTable(p, token);
|
|
2611
|
-
}
|
|
2612
|
-
}
|
|
2613
|
-
}
|
|
2614
|
-
function endTagInTable(p, token) {
|
|
2615
|
-
switch (token.tagID) {
|
|
2616
|
-
case html.TAG_ID.TABLE:
|
|
2617
|
-
{
|
|
2618
|
-
if (p.openElements.hasInTableScope(html.TAG_ID.TABLE)) {
|
|
2619
|
-
p.openElements.popUntilTagNamePopped(html.TAG_ID.TABLE);
|
|
2620
|
-
p._resetInsertionMode();
|
|
2621
|
-
}
|
|
2622
|
-
break;
|
|
2623
|
-
}
|
|
2624
|
-
case html.TAG_ID.TEMPLATE:
|
|
2625
|
-
{
|
|
2626
|
-
templateEndTagInHead(p, token);
|
|
2627
|
-
break;
|
|
2628
|
-
}
|
|
2629
|
-
case html.TAG_ID.BODY:
|
|
2630
|
-
case html.TAG_ID.CAPTION:
|
|
2631
|
-
case html.TAG_ID.COL:
|
|
2632
|
-
case html.TAG_ID.COLGROUP:
|
|
2633
|
-
case html.TAG_ID.HTML:
|
|
2634
|
-
case html.TAG_ID.TBODY:
|
|
2635
|
-
case html.TAG_ID.TD:
|
|
2636
|
-
case html.TAG_ID.TFOOT:
|
|
2637
|
-
case html.TAG_ID.TH:
|
|
2638
|
-
case html.TAG_ID.THEAD:
|
|
2639
|
-
case html.TAG_ID.TR:
|
|
2640
|
-
{
|
|
2641
|
-
// Ignore token
|
|
2642
|
-
break;
|
|
2643
|
-
}
|
|
2644
|
-
default:
|
|
2645
|
-
{
|
|
2646
|
-
tokenInTable(p, token);
|
|
2647
|
-
}
|
|
2648
|
-
}
|
|
2649
|
-
}
|
|
2650
|
-
function tokenInTable(p, token) {
|
|
2651
|
-
const savedFosterParentingState = p.fosterParentingEnabled;
|
|
2652
|
-
p.fosterParentingEnabled = true;
|
|
2653
|
-
// Process token in `In Body` mode
|
|
2654
|
-
modeInBody(p, token);
|
|
2655
|
-
p.fosterParentingEnabled = savedFosterParentingState;
|
|
2656
|
-
}
|
|
2657
|
-
// The "in table text" insertion mode
|
|
2658
|
-
//------------------------------------------------------------------
|
|
2659
|
-
function whitespaceCharacterInTableText(p, token) {
|
|
2660
|
-
p.pendingCharacterTokens.push(token);
|
|
2661
|
-
}
|
|
2662
|
-
function characterInTableText(p, token) {
|
|
2663
|
-
p.pendingCharacterTokens.push(token);
|
|
2664
|
-
p.hasNonWhitespacePendingCharacterToken = true;
|
|
2665
|
-
}
|
|
2666
|
-
function tokenInTableText(p, token) {
|
|
2667
|
-
let i = 0;
|
|
2668
|
-
if (p.hasNonWhitespacePendingCharacterToken) {
|
|
2669
|
-
for (; i < p.pendingCharacterTokens.length; i++) {
|
|
2670
|
-
tokenInTable(p, p.pendingCharacterTokens[i]);
|
|
2671
|
-
}
|
|
2672
|
-
} else {
|
|
2673
|
-
for (; i < p.pendingCharacterTokens.length; i++) {
|
|
2674
|
-
p._insertCharacters(p.pendingCharacterTokens[i]);
|
|
2675
|
-
}
|
|
2676
|
-
}
|
|
2677
|
-
p.insertionMode = p.originalInsertionMode;
|
|
2678
|
-
p._processToken(token);
|
|
2679
|
-
}
|
|
2680
|
-
// The "in caption" insertion mode
|
|
2681
|
-
//------------------------------------------------------------------
|
|
2682
|
-
const TABLE_VOID_ELEMENTS = new Set([html.TAG_ID.CAPTION, html.TAG_ID.COL, html.TAG_ID.COLGROUP, html.TAG_ID.TBODY, html.TAG_ID.TD, html.TAG_ID.TFOOT, html.TAG_ID.TH, html.TAG_ID.THEAD, html.TAG_ID.TR]);
|
|
2683
|
-
function startTagInCaption(p, token) {
|
|
2684
|
-
const tn = token.tagID;
|
|
2685
|
-
if (TABLE_VOID_ELEMENTS.has(tn)) {
|
|
2686
|
-
if (p.openElements.hasInTableScope(html.TAG_ID.CAPTION)) {
|
|
2687
|
-
p.openElements.generateImpliedEndTags();
|
|
2688
|
-
p.openElements.popUntilTagNamePopped(html.TAG_ID.CAPTION);
|
|
2689
|
-
p.activeFormattingElements.clearToLastMarker();
|
|
2690
|
-
p.insertionMode = InsertionMode.IN_TABLE;
|
|
2691
|
-
startTagInTable(p, token);
|
|
2692
|
-
}
|
|
2693
|
-
} else {
|
|
2694
|
-
startTagInBody(p, token);
|
|
2695
|
-
}
|
|
2696
|
-
}
|
|
2697
|
-
function endTagInCaption(p, token) {
|
|
2698
|
-
const tn = token.tagID;
|
|
2699
|
-
switch (tn) {
|
|
2700
|
-
case html.TAG_ID.CAPTION:
|
|
2701
|
-
case html.TAG_ID.TABLE:
|
|
2702
|
-
{
|
|
2703
|
-
if (p.openElements.hasInTableScope(html.TAG_ID.CAPTION)) {
|
|
2704
|
-
p.openElements.generateImpliedEndTags();
|
|
2705
|
-
p.openElements.popUntilTagNamePopped(html.TAG_ID.CAPTION);
|
|
2706
|
-
p.activeFormattingElements.clearToLastMarker();
|
|
2707
|
-
p.insertionMode = InsertionMode.IN_TABLE;
|
|
2708
|
-
if (tn === html.TAG_ID.TABLE) {
|
|
2709
|
-
endTagInTable(p, token);
|
|
2710
|
-
}
|
|
2711
|
-
}
|
|
2712
|
-
break;
|
|
2713
|
-
}
|
|
2714
|
-
case html.TAG_ID.BODY:
|
|
2715
|
-
case html.TAG_ID.COL:
|
|
2716
|
-
case html.TAG_ID.COLGROUP:
|
|
2717
|
-
case html.TAG_ID.HTML:
|
|
2718
|
-
case html.TAG_ID.TBODY:
|
|
2719
|
-
case html.TAG_ID.TD:
|
|
2720
|
-
case html.TAG_ID.TFOOT:
|
|
2721
|
-
case html.TAG_ID.TH:
|
|
2722
|
-
case html.TAG_ID.THEAD:
|
|
2723
|
-
case html.TAG_ID.TR:
|
|
2724
|
-
{
|
|
2725
|
-
// Ignore token
|
|
2726
|
-
break;
|
|
2727
|
-
}
|
|
2728
|
-
default:
|
|
2729
|
-
{
|
|
2730
|
-
endTagInBody(p, token);
|
|
2731
|
-
}
|
|
2732
|
-
}
|
|
2733
|
-
}
|
|
2734
|
-
// The "in column group" insertion mode
|
|
2735
|
-
//------------------------------------------------------------------
|
|
2736
|
-
function startTagInColumnGroup(p, token) {
|
|
2737
|
-
switch (token.tagID) {
|
|
2738
|
-
case html.TAG_ID.HTML:
|
|
2739
|
-
{
|
|
2740
|
-
startTagInBody(p, token);
|
|
2741
|
-
break;
|
|
2742
|
-
}
|
|
2743
|
-
case html.TAG_ID.COL:
|
|
2744
|
-
{
|
|
2745
|
-
p._appendElement(token, html.NS.HTML);
|
|
2746
|
-
token.ackSelfClosing = true;
|
|
2747
|
-
break;
|
|
2748
|
-
}
|
|
2749
|
-
case html.TAG_ID.TEMPLATE:
|
|
2750
|
-
{
|
|
2751
|
-
startTagInHead(p, token);
|
|
2752
|
-
break;
|
|
2753
|
-
}
|
|
2754
|
-
default:
|
|
2755
|
-
{
|
|
2756
|
-
tokenInColumnGroup(p, token);
|
|
2757
|
-
}
|
|
2758
|
-
}
|
|
2759
|
-
}
|
|
2760
|
-
function endTagInColumnGroup(p, token) {
|
|
2761
|
-
switch (token.tagID) {
|
|
2762
|
-
case html.TAG_ID.COLGROUP:
|
|
2763
|
-
{
|
|
2764
|
-
if (p.openElements.currentTagId === html.TAG_ID.COLGROUP) {
|
|
2765
|
-
p.openElements.pop();
|
|
2766
|
-
p.insertionMode = InsertionMode.IN_TABLE;
|
|
2767
|
-
}
|
|
2768
|
-
break;
|
|
2769
|
-
}
|
|
2770
|
-
case html.TAG_ID.TEMPLATE:
|
|
2771
|
-
{
|
|
2772
|
-
templateEndTagInHead(p, token);
|
|
2773
|
-
break;
|
|
2774
|
-
}
|
|
2775
|
-
case html.TAG_ID.COL:
|
|
2776
|
-
{
|
|
2777
|
-
// Ignore token
|
|
2778
|
-
break;
|
|
2779
|
-
}
|
|
2780
|
-
default:
|
|
2781
|
-
{
|
|
2782
|
-
tokenInColumnGroup(p, token);
|
|
2783
|
-
}
|
|
2784
|
-
}
|
|
2785
|
-
}
|
|
2786
|
-
function tokenInColumnGroup(p, token) {
|
|
2787
|
-
if (p.openElements.currentTagId === html.TAG_ID.COLGROUP) {
|
|
2788
|
-
p.openElements.pop();
|
|
2789
|
-
p.insertionMode = InsertionMode.IN_TABLE;
|
|
2790
|
-
p._processToken(token);
|
|
2791
|
-
}
|
|
2792
|
-
}
|
|
2793
|
-
// The "in table body" insertion mode
|
|
2794
|
-
//------------------------------------------------------------------
|
|
2795
|
-
function startTagInTableBody(p, token) {
|
|
2796
|
-
switch (token.tagID) {
|
|
2797
|
-
case html.TAG_ID.TR:
|
|
2798
|
-
{
|
|
2799
|
-
p.openElements.clearBackToTableBodyContext();
|
|
2800
|
-
p._insertElement(token, html.NS.HTML);
|
|
2801
|
-
p.insertionMode = InsertionMode.IN_ROW;
|
|
2802
|
-
break;
|
|
2803
|
-
}
|
|
2804
|
-
case html.TAG_ID.TH:
|
|
2805
|
-
case html.TAG_ID.TD:
|
|
2806
|
-
{
|
|
2807
|
-
p.openElements.clearBackToTableBodyContext();
|
|
2808
|
-
p._insertFakeElement(html.TAG_NAMES.TR, html.TAG_ID.TR);
|
|
2809
|
-
p.insertionMode = InsertionMode.IN_ROW;
|
|
2810
|
-
startTagInRow(p, token);
|
|
2811
|
-
break;
|
|
2812
|
-
}
|
|
2813
|
-
case html.TAG_ID.CAPTION:
|
|
2814
|
-
case html.TAG_ID.COL:
|
|
2815
|
-
case html.TAG_ID.COLGROUP:
|
|
2816
|
-
case html.TAG_ID.TBODY:
|
|
2817
|
-
case html.TAG_ID.TFOOT:
|
|
2818
|
-
case html.TAG_ID.THEAD:
|
|
2819
|
-
{
|
|
2820
|
-
if (p.openElements.hasTableBodyContextInTableScope()) {
|
|
2821
|
-
p.openElements.clearBackToTableBodyContext();
|
|
2822
|
-
p.openElements.pop();
|
|
2823
|
-
p.insertionMode = InsertionMode.IN_TABLE;
|
|
2824
|
-
startTagInTable(p, token);
|
|
2825
|
-
}
|
|
2826
|
-
break;
|
|
2827
|
-
}
|
|
2828
|
-
default:
|
|
2829
|
-
{
|
|
2830
|
-
startTagInTable(p, token);
|
|
2831
|
-
}
|
|
2832
|
-
}
|
|
2833
|
-
}
|
|
2834
|
-
function endTagInTableBody(p, token) {
|
|
2835
|
-
const tn = token.tagID;
|
|
2836
|
-
switch (token.tagID) {
|
|
2837
|
-
case html.TAG_ID.TBODY:
|
|
2838
|
-
case html.TAG_ID.TFOOT:
|
|
2839
|
-
case html.TAG_ID.THEAD:
|
|
2840
|
-
{
|
|
2841
|
-
if (p.openElements.hasInTableScope(tn)) {
|
|
2842
|
-
p.openElements.clearBackToTableBodyContext();
|
|
2843
|
-
p.openElements.pop();
|
|
2844
|
-
p.insertionMode = InsertionMode.IN_TABLE;
|
|
2845
|
-
}
|
|
2846
|
-
break;
|
|
2847
|
-
}
|
|
2848
|
-
case html.TAG_ID.TABLE:
|
|
2849
|
-
{
|
|
2850
|
-
if (p.openElements.hasTableBodyContextInTableScope()) {
|
|
2851
|
-
p.openElements.clearBackToTableBodyContext();
|
|
2852
|
-
p.openElements.pop();
|
|
2853
|
-
p.insertionMode = InsertionMode.IN_TABLE;
|
|
2854
|
-
endTagInTable(p, token);
|
|
2855
|
-
}
|
|
2856
|
-
break;
|
|
2857
|
-
}
|
|
2858
|
-
case html.TAG_ID.BODY:
|
|
2859
|
-
case html.TAG_ID.CAPTION:
|
|
2860
|
-
case html.TAG_ID.COL:
|
|
2861
|
-
case html.TAG_ID.COLGROUP:
|
|
2862
|
-
case html.TAG_ID.HTML:
|
|
2863
|
-
case html.TAG_ID.TD:
|
|
2864
|
-
case html.TAG_ID.TH:
|
|
2865
|
-
case html.TAG_ID.TR:
|
|
2866
|
-
{
|
|
2867
|
-
// Ignore token
|
|
2868
|
-
break;
|
|
2869
|
-
}
|
|
2870
|
-
default:
|
|
2871
|
-
{
|
|
2872
|
-
endTagInTable(p, token);
|
|
2873
|
-
}
|
|
2874
|
-
}
|
|
2875
|
-
}
|
|
2876
|
-
// The "in row" insertion mode
|
|
2877
|
-
//------------------------------------------------------------------
|
|
2878
|
-
function startTagInRow(p, token) {
|
|
2879
|
-
switch (token.tagID) {
|
|
2880
|
-
case html.TAG_ID.TH:
|
|
2881
|
-
case html.TAG_ID.TD:
|
|
2882
|
-
{
|
|
2883
|
-
p.openElements.clearBackToTableRowContext();
|
|
2884
|
-
p._insertElement(token, html.NS.HTML);
|
|
2885
|
-
p.insertionMode = InsertionMode.IN_CELL;
|
|
2886
|
-
p.activeFormattingElements.insertMarker();
|
|
2887
|
-
break;
|
|
2888
|
-
}
|
|
2889
|
-
case html.TAG_ID.CAPTION:
|
|
2890
|
-
case html.TAG_ID.COL:
|
|
2891
|
-
case html.TAG_ID.COLGROUP:
|
|
2892
|
-
case html.TAG_ID.TBODY:
|
|
2893
|
-
case html.TAG_ID.TFOOT:
|
|
2894
|
-
case html.TAG_ID.THEAD:
|
|
2895
|
-
case html.TAG_ID.TR:
|
|
2896
|
-
{
|
|
2897
|
-
if (p.openElements.hasInTableScope(html.TAG_ID.TR)) {
|
|
2898
|
-
p.openElements.clearBackToTableRowContext();
|
|
2899
|
-
p.openElements.pop();
|
|
2900
|
-
p.insertionMode = InsertionMode.IN_TABLE_BODY;
|
|
2901
|
-
startTagInTableBody(p, token);
|
|
2902
|
-
}
|
|
2903
|
-
break;
|
|
2904
|
-
}
|
|
2905
|
-
default:
|
|
2906
|
-
{
|
|
2907
|
-
startTagInTable(p, token);
|
|
2908
|
-
}
|
|
2909
|
-
}
|
|
2910
|
-
}
|
|
2911
|
-
function endTagInRow(p, token) {
|
|
2912
|
-
switch (token.tagID) {
|
|
2913
|
-
case html.TAG_ID.TR:
|
|
2914
|
-
{
|
|
2915
|
-
if (p.openElements.hasInTableScope(html.TAG_ID.TR)) {
|
|
2916
|
-
p.openElements.clearBackToTableRowContext();
|
|
2917
|
-
p.openElements.pop();
|
|
2918
|
-
p.insertionMode = InsertionMode.IN_TABLE_BODY;
|
|
2919
|
-
}
|
|
2920
|
-
break;
|
|
2921
|
-
}
|
|
2922
|
-
case html.TAG_ID.TABLE:
|
|
2923
|
-
{
|
|
2924
|
-
if (p.openElements.hasInTableScope(html.TAG_ID.TR)) {
|
|
2925
|
-
p.openElements.clearBackToTableRowContext();
|
|
2926
|
-
p.openElements.pop();
|
|
2927
|
-
p.insertionMode = InsertionMode.IN_TABLE_BODY;
|
|
2928
|
-
endTagInTableBody(p, token);
|
|
2929
|
-
}
|
|
2930
|
-
break;
|
|
2931
|
-
}
|
|
2932
|
-
case html.TAG_ID.TBODY:
|
|
2933
|
-
case html.TAG_ID.TFOOT:
|
|
2934
|
-
case html.TAG_ID.THEAD:
|
|
2935
|
-
{
|
|
2936
|
-
if (p.openElements.hasInTableScope(token.tagID) || p.openElements.hasInTableScope(html.TAG_ID.TR)) {
|
|
2937
|
-
p.openElements.clearBackToTableRowContext();
|
|
2938
|
-
p.openElements.pop();
|
|
2939
|
-
p.insertionMode = InsertionMode.IN_TABLE_BODY;
|
|
2940
|
-
endTagInTableBody(p, token);
|
|
2941
|
-
}
|
|
2942
|
-
break;
|
|
2943
|
-
}
|
|
2944
|
-
case html.TAG_ID.BODY:
|
|
2945
|
-
case html.TAG_ID.CAPTION:
|
|
2946
|
-
case html.TAG_ID.COL:
|
|
2947
|
-
case html.TAG_ID.COLGROUP:
|
|
2948
|
-
case html.TAG_ID.HTML:
|
|
2949
|
-
case html.TAG_ID.TD:
|
|
2950
|
-
case html.TAG_ID.TH:
|
|
2951
|
-
{
|
|
2952
|
-
// Ignore end tag
|
|
2953
|
-
break;
|
|
2954
|
-
}
|
|
2955
|
-
default:
|
|
2956
|
-
{
|
|
2957
|
-
endTagInTable(p, token);
|
|
2958
|
-
}
|
|
2959
|
-
}
|
|
2960
|
-
}
|
|
2961
|
-
// The "in cell" insertion mode
|
|
2962
|
-
//------------------------------------------------------------------
|
|
2963
|
-
function startTagInCell(p, token) {
|
|
2964
|
-
const tn = token.tagID;
|
|
2965
|
-
if (TABLE_VOID_ELEMENTS.has(tn)) {
|
|
2966
|
-
if (p.openElements.hasInTableScope(html.TAG_ID.TD) || p.openElements.hasInTableScope(html.TAG_ID.TH)) {
|
|
2967
|
-
p._closeTableCell();
|
|
2968
|
-
startTagInRow(p, token);
|
|
2969
|
-
}
|
|
2970
|
-
} else {
|
|
2971
|
-
startTagInBody(p, token);
|
|
2972
|
-
}
|
|
2973
|
-
}
|
|
2974
|
-
function endTagInCell(p, token) {
|
|
2975
|
-
const tn = token.tagID;
|
|
2976
|
-
switch (tn) {
|
|
2977
|
-
case html.TAG_ID.TD:
|
|
2978
|
-
case html.TAG_ID.TH:
|
|
2979
|
-
{
|
|
2980
|
-
if (p.openElements.hasInTableScope(tn)) {
|
|
2981
|
-
p.openElements.generateImpliedEndTags();
|
|
2982
|
-
p.openElements.popUntilTagNamePopped(tn);
|
|
2983
|
-
p.activeFormattingElements.clearToLastMarker();
|
|
2984
|
-
p.insertionMode = InsertionMode.IN_ROW;
|
|
2985
|
-
}
|
|
2986
|
-
break;
|
|
2987
|
-
}
|
|
2988
|
-
case html.TAG_ID.TABLE:
|
|
2989
|
-
case html.TAG_ID.TBODY:
|
|
2990
|
-
case html.TAG_ID.TFOOT:
|
|
2991
|
-
case html.TAG_ID.THEAD:
|
|
2992
|
-
case html.TAG_ID.TR:
|
|
2993
|
-
{
|
|
2994
|
-
if (p.openElements.hasInTableScope(tn)) {
|
|
2995
|
-
p._closeTableCell();
|
|
2996
|
-
endTagInRow(p, token);
|
|
2997
|
-
}
|
|
2998
|
-
break;
|
|
2999
|
-
}
|
|
3000
|
-
case html.TAG_ID.BODY:
|
|
3001
|
-
case html.TAG_ID.CAPTION:
|
|
3002
|
-
case html.TAG_ID.COL:
|
|
3003
|
-
case html.TAG_ID.COLGROUP:
|
|
3004
|
-
case html.TAG_ID.HTML:
|
|
3005
|
-
{
|
|
3006
|
-
// Ignore token
|
|
3007
|
-
break;
|
|
3008
|
-
}
|
|
3009
|
-
default:
|
|
3010
|
-
{
|
|
3011
|
-
endTagInBody(p, token);
|
|
3012
|
-
}
|
|
3013
|
-
}
|
|
3014
|
-
}
|
|
3015
|
-
// The "in select" insertion mode
|
|
3016
|
-
//------------------------------------------------------------------
|
|
3017
|
-
function startTagInSelect(p, token) {
|
|
3018
|
-
switch (token.tagID) {
|
|
3019
|
-
case html.TAG_ID.HTML:
|
|
3020
|
-
{
|
|
3021
|
-
startTagInBody(p, token);
|
|
3022
|
-
break;
|
|
3023
|
-
}
|
|
3024
|
-
case html.TAG_ID.OPTION:
|
|
3025
|
-
{
|
|
3026
|
-
if (p.openElements.currentTagId === html.TAG_ID.OPTION) {
|
|
3027
|
-
p.openElements.pop();
|
|
3028
|
-
}
|
|
3029
|
-
p._insertElement(token, html.NS.HTML);
|
|
3030
|
-
break;
|
|
3031
|
-
}
|
|
3032
|
-
case html.TAG_ID.OPTGROUP:
|
|
3033
|
-
{
|
|
3034
|
-
if (p.openElements.currentTagId === html.TAG_ID.OPTION) {
|
|
3035
|
-
p.openElements.pop();
|
|
3036
|
-
}
|
|
3037
|
-
if (p.openElements.currentTagId === html.TAG_ID.OPTGROUP) {
|
|
3038
|
-
p.openElements.pop();
|
|
3039
|
-
}
|
|
3040
|
-
p._insertElement(token, html.NS.HTML);
|
|
3041
|
-
break;
|
|
3042
|
-
}
|
|
3043
|
-
case html.TAG_ID.INPUT:
|
|
3044
|
-
case html.TAG_ID.KEYGEN:
|
|
3045
|
-
case html.TAG_ID.TEXTAREA:
|
|
3046
|
-
case html.TAG_ID.SELECT:
|
|
3047
|
-
{
|
|
3048
|
-
if (p.openElements.hasInSelectScope(html.TAG_ID.SELECT)) {
|
|
3049
|
-
p.openElements.popUntilTagNamePopped(html.TAG_ID.SELECT);
|
|
3050
|
-
p._resetInsertionMode();
|
|
3051
|
-
if (token.tagID !== html.TAG_ID.SELECT) {
|
|
3052
|
-
p._processStartTag(token);
|
|
3053
|
-
}
|
|
3054
|
-
}
|
|
3055
|
-
break;
|
|
3056
|
-
}
|
|
3057
|
-
case html.TAG_ID.SCRIPT:
|
|
3058
|
-
case html.TAG_ID.TEMPLATE:
|
|
3059
|
-
{
|
|
3060
|
-
startTagInHead(p, token);
|
|
3061
|
-
break;
|
|
3062
|
-
}
|
|
3063
|
-
default:
|
|
3064
|
-
// Do nothing
|
|
3065
|
-
}
|
|
3066
|
-
}
|
|
3067
|
-
function endTagInSelect(p, token) {
|
|
3068
|
-
switch (token.tagID) {
|
|
3069
|
-
case html.TAG_ID.OPTGROUP:
|
|
3070
|
-
{
|
|
3071
|
-
if (p.openElements.stackTop > 0 && p.openElements.currentTagId === html.TAG_ID.OPTION && p.openElements.tagIDs[p.openElements.stackTop - 1] === html.TAG_ID.OPTGROUP) {
|
|
3072
|
-
p.openElements.pop();
|
|
3073
|
-
}
|
|
3074
|
-
if (p.openElements.currentTagId === html.TAG_ID.OPTGROUP) {
|
|
3075
|
-
p.openElements.pop();
|
|
3076
|
-
}
|
|
3077
|
-
break;
|
|
3078
|
-
}
|
|
3079
|
-
case html.TAG_ID.OPTION:
|
|
3080
|
-
{
|
|
3081
|
-
if (p.openElements.currentTagId === html.TAG_ID.OPTION) {
|
|
3082
|
-
p.openElements.pop();
|
|
3083
|
-
}
|
|
3084
|
-
break;
|
|
3085
|
-
}
|
|
3086
|
-
case html.TAG_ID.SELECT:
|
|
3087
|
-
{
|
|
3088
|
-
if (p.openElements.hasInSelectScope(html.TAG_ID.SELECT)) {
|
|
3089
|
-
p.openElements.popUntilTagNamePopped(html.TAG_ID.SELECT);
|
|
3090
|
-
p._resetInsertionMode();
|
|
3091
|
-
}
|
|
3092
|
-
break;
|
|
3093
|
-
}
|
|
3094
|
-
case html.TAG_ID.TEMPLATE:
|
|
3095
|
-
{
|
|
3096
|
-
templateEndTagInHead(p, token);
|
|
3097
|
-
break;
|
|
3098
|
-
}
|
|
3099
|
-
default:
|
|
3100
|
-
// Do nothing
|
|
3101
|
-
}
|
|
3102
|
-
}
|
|
3103
|
-
// The "in select in table" insertion mode
|
|
3104
|
-
//------------------------------------------------------------------
|
|
3105
|
-
function startTagInSelectInTable(p, token) {
|
|
3106
|
-
const tn = token.tagID;
|
|
3107
|
-
if (tn === html.TAG_ID.CAPTION || tn === html.TAG_ID.TABLE || tn === html.TAG_ID.TBODY || tn === html.TAG_ID.TFOOT || tn === html.TAG_ID.THEAD || tn === html.TAG_ID.TR || tn === html.TAG_ID.TD || tn === html.TAG_ID.TH) {
|
|
3108
|
-
p.openElements.popUntilTagNamePopped(html.TAG_ID.SELECT);
|
|
3109
|
-
p._resetInsertionMode();
|
|
3110
|
-
p._processStartTag(token);
|
|
3111
|
-
} else {
|
|
3112
|
-
startTagInSelect(p, token);
|
|
3113
|
-
}
|
|
3114
|
-
}
|
|
3115
|
-
function endTagInSelectInTable(p, token) {
|
|
3116
|
-
const tn = token.tagID;
|
|
3117
|
-
if (tn === html.TAG_ID.CAPTION || tn === html.TAG_ID.TABLE || tn === html.TAG_ID.TBODY || tn === html.TAG_ID.TFOOT || tn === html.TAG_ID.THEAD || tn === html.TAG_ID.TR || tn === html.TAG_ID.TD || tn === html.TAG_ID.TH) {
|
|
3118
|
-
if (p.openElements.hasInTableScope(tn)) {
|
|
3119
|
-
p.openElements.popUntilTagNamePopped(html.TAG_ID.SELECT);
|
|
3120
|
-
p._resetInsertionMode();
|
|
3121
|
-
p.onEndTag(token);
|
|
3122
|
-
}
|
|
3123
|
-
} else {
|
|
3124
|
-
endTagInSelect(p, token);
|
|
3125
|
-
}
|
|
3126
|
-
}
|
|
3127
|
-
// The "in template" insertion mode
|
|
3128
|
-
//------------------------------------------------------------------
|
|
3129
|
-
function startTagInTemplate(p, token) {
|
|
3130
|
-
switch (token.tagID) {
|
|
3131
|
-
// First, handle tags that can start without a mode change
|
|
3132
|
-
case html.TAG_ID.BASE:
|
|
3133
|
-
case html.TAG_ID.BASEFONT:
|
|
3134
|
-
case html.TAG_ID.BGSOUND:
|
|
3135
|
-
case html.TAG_ID.LINK:
|
|
3136
|
-
case html.TAG_ID.META:
|
|
3137
|
-
case html.TAG_ID.NOFRAMES:
|
|
3138
|
-
case html.TAG_ID.SCRIPT:
|
|
3139
|
-
case html.TAG_ID.STYLE:
|
|
3140
|
-
case html.TAG_ID.TEMPLATE:
|
|
3141
|
-
case html.TAG_ID.TITLE:
|
|
3142
|
-
{
|
|
3143
|
-
startTagInHead(p, token);
|
|
3144
|
-
break;
|
|
3145
|
-
}
|
|
3146
|
-
// Re-process the token in the appropriate mode
|
|
3147
|
-
case html.TAG_ID.CAPTION:
|
|
3148
|
-
case html.TAG_ID.COLGROUP:
|
|
3149
|
-
case html.TAG_ID.TBODY:
|
|
3150
|
-
case html.TAG_ID.TFOOT:
|
|
3151
|
-
case html.TAG_ID.THEAD:
|
|
3152
|
-
{
|
|
3153
|
-
p.tmplInsertionModeStack[0] = InsertionMode.IN_TABLE;
|
|
3154
|
-
p.insertionMode = InsertionMode.IN_TABLE;
|
|
3155
|
-
startTagInTable(p, token);
|
|
3156
|
-
break;
|
|
3157
|
-
}
|
|
3158
|
-
case html.TAG_ID.COL:
|
|
3159
|
-
{
|
|
3160
|
-
p.tmplInsertionModeStack[0] = InsertionMode.IN_COLUMN_GROUP;
|
|
3161
|
-
p.insertionMode = InsertionMode.IN_COLUMN_GROUP;
|
|
3162
|
-
startTagInColumnGroup(p, token);
|
|
3163
|
-
break;
|
|
3164
|
-
}
|
|
3165
|
-
case html.TAG_ID.TR:
|
|
3166
|
-
{
|
|
3167
|
-
p.tmplInsertionModeStack[0] = InsertionMode.IN_TABLE_BODY;
|
|
3168
|
-
p.insertionMode = InsertionMode.IN_TABLE_BODY;
|
|
3169
|
-
startTagInTableBody(p, token);
|
|
3170
|
-
break;
|
|
3171
|
-
}
|
|
3172
|
-
case html.TAG_ID.TD:
|
|
3173
|
-
case html.TAG_ID.TH:
|
|
3174
|
-
{
|
|
3175
|
-
p.tmplInsertionModeStack[0] = InsertionMode.IN_ROW;
|
|
3176
|
-
p.insertionMode = InsertionMode.IN_ROW;
|
|
3177
|
-
startTagInRow(p, token);
|
|
3178
|
-
break;
|
|
3179
|
-
}
|
|
3180
|
-
default:
|
|
3181
|
-
{
|
|
3182
|
-
p.tmplInsertionModeStack[0] = InsertionMode.IN_BODY;
|
|
3183
|
-
p.insertionMode = InsertionMode.IN_BODY;
|
|
3184
|
-
startTagInBody(p, token);
|
|
3185
|
-
}
|
|
3186
|
-
}
|
|
3187
|
-
}
|
|
3188
|
-
function endTagInTemplate(p, token) {
|
|
3189
|
-
if (token.tagID === html.TAG_ID.TEMPLATE) {
|
|
3190
|
-
templateEndTagInHead(p, token);
|
|
3191
|
-
}
|
|
3192
|
-
}
|
|
3193
|
-
function eofInTemplate(p, token) {
|
|
3194
|
-
if (p.openElements.tmplCount > 0) {
|
|
3195
|
-
p.openElements.popUntilTagNamePopped(html.TAG_ID.TEMPLATE);
|
|
3196
|
-
p.activeFormattingElements.clearToLastMarker();
|
|
3197
|
-
p.tmplInsertionModeStack.shift();
|
|
3198
|
-
p._resetInsertionMode();
|
|
3199
|
-
p.onEof(token);
|
|
3200
|
-
} else {
|
|
3201
|
-
stopParsing(p, token);
|
|
3202
|
-
}
|
|
3203
|
-
}
|
|
3204
|
-
// The "after body" insertion mode
|
|
3205
|
-
//------------------------------------------------------------------
|
|
3206
|
-
function startTagAfterBody(p, token) {
|
|
3207
|
-
if (token.tagID === html.TAG_ID.HTML) {
|
|
3208
|
-
startTagInBody(p, token);
|
|
3209
|
-
} else {
|
|
3210
|
-
tokenAfterBody(p, token);
|
|
3211
|
-
}
|
|
3212
|
-
}
|
|
3213
|
-
function endTagAfterBody(p, token) {
|
|
3214
|
-
var _a;
|
|
3215
|
-
if (token.tagID === html.TAG_ID.HTML) {
|
|
3216
|
-
if (!p.fragmentContext) {
|
|
3217
|
-
p.insertionMode = InsertionMode.AFTER_AFTER_BODY;
|
|
3218
|
-
}
|
|
3219
|
-
//NOTE: <html> is never popped from the stack, so we need to updated
|
|
3220
|
-
//the end location explicitly.
|
|
3221
|
-
if (p.options.sourceCodeLocationInfo && p.openElements.tagIDs[0] === html.TAG_ID.HTML) {
|
|
3222
|
-
p._setEndLocation(p.openElements.items[0], token);
|
|
3223
|
-
// Update the body element, if it doesn't have an end tag
|
|
3224
|
-
const bodyElement = p.openElements.items[1];
|
|
3225
|
-
if (bodyElement && !((_a = p.treeAdapter.getNodeSourceCodeLocation(bodyElement)) === null || _a === void 0 ? void 0 : _a.endTag)) {
|
|
3226
|
-
p._setEndLocation(bodyElement, token);
|
|
3227
|
-
}
|
|
3228
|
-
}
|
|
3229
|
-
} else {
|
|
3230
|
-
tokenAfterBody(p, token);
|
|
3231
|
-
}
|
|
3232
|
-
}
|
|
3233
|
-
function tokenAfterBody(p, token) {
|
|
3234
|
-
p.insertionMode = InsertionMode.IN_BODY;
|
|
3235
|
-
modeInBody(p, token);
|
|
3236
|
-
}
|
|
3237
|
-
// The "in frameset" insertion mode
|
|
3238
|
-
//------------------------------------------------------------------
|
|
3239
|
-
function startTagInFrameset(p, token) {
|
|
3240
|
-
switch (token.tagID) {
|
|
3241
|
-
case html.TAG_ID.HTML:
|
|
3242
|
-
{
|
|
3243
|
-
startTagInBody(p, token);
|
|
3244
|
-
break;
|
|
3245
|
-
}
|
|
3246
|
-
case html.TAG_ID.FRAMESET:
|
|
3247
|
-
{
|
|
3248
|
-
p._insertElement(token, html.NS.HTML);
|
|
3249
|
-
break;
|
|
3250
|
-
}
|
|
3251
|
-
case html.TAG_ID.FRAME:
|
|
3252
|
-
{
|
|
3253
|
-
p._appendElement(token, html.NS.HTML);
|
|
3254
|
-
token.ackSelfClosing = true;
|
|
3255
|
-
break;
|
|
3256
|
-
}
|
|
3257
|
-
case html.TAG_ID.NOFRAMES:
|
|
3258
|
-
{
|
|
3259
|
-
startTagInHead(p, token);
|
|
3260
|
-
break;
|
|
3261
|
-
}
|
|
3262
|
-
default:
|
|
3263
|
-
// Do nothing
|
|
3264
|
-
}
|
|
3265
|
-
}
|
|
3266
|
-
function endTagInFrameset(p, token) {
|
|
3267
|
-
if (token.tagID === html.TAG_ID.FRAMESET && !p.openElements.isRootHtmlElementCurrent()) {
|
|
3268
|
-
p.openElements.pop();
|
|
3269
|
-
if (!p.fragmentContext && p.openElements.currentTagId !== html.TAG_ID.FRAMESET) {
|
|
3270
|
-
p.insertionMode = InsertionMode.AFTER_FRAMESET;
|
|
3271
|
-
}
|
|
3272
|
-
}
|
|
3273
|
-
}
|
|
3274
|
-
// The "after frameset" insertion mode
|
|
3275
|
-
//------------------------------------------------------------------
|
|
3276
|
-
function startTagAfterFrameset(p, token) {
|
|
3277
|
-
switch (token.tagID) {
|
|
3278
|
-
case html.TAG_ID.HTML:
|
|
3279
|
-
{
|
|
3280
|
-
startTagInBody(p, token);
|
|
3281
|
-
break;
|
|
3282
|
-
}
|
|
3283
|
-
case html.TAG_ID.NOFRAMES:
|
|
3284
|
-
{
|
|
3285
|
-
startTagInHead(p, token);
|
|
3286
|
-
break;
|
|
3287
|
-
}
|
|
3288
|
-
default:
|
|
3289
|
-
// Do nothing
|
|
3290
|
-
}
|
|
3291
|
-
}
|
|
3292
|
-
function endTagAfterFrameset(p, token) {
|
|
3293
|
-
if (token.tagID === html.TAG_ID.HTML) {
|
|
3294
|
-
p.insertionMode = InsertionMode.AFTER_AFTER_FRAMESET;
|
|
3295
|
-
}
|
|
3296
|
-
}
|
|
3297
|
-
// The "after after body" insertion mode
|
|
3298
|
-
//------------------------------------------------------------------
|
|
3299
|
-
function startTagAfterAfterBody(p, token) {
|
|
3300
|
-
if (token.tagID === html.TAG_ID.HTML) {
|
|
3301
|
-
startTagInBody(p, token);
|
|
3302
|
-
} else {
|
|
3303
|
-
tokenAfterAfterBody(p, token);
|
|
3304
|
-
}
|
|
3305
|
-
}
|
|
3306
|
-
function tokenAfterAfterBody(p, token) {
|
|
3307
|
-
p.insertionMode = InsertionMode.IN_BODY;
|
|
3308
|
-
modeInBody(p, token);
|
|
3309
|
-
}
|
|
3310
|
-
// The "after after frameset" insertion mode
|
|
3311
|
-
//------------------------------------------------------------------
|
|
3312
|
-
function startTagAfterAfterFrameset(p, token) {
|
|
3313
|
-
switch (token.tagID) {
|
|
3314
|
-
case html.TAG_ID.HTML:
|
|
3315
|
-
{
|
|
3316
|
-
startTagInBody(p, token);
|
|
3317
|
-
break;
|
|
3318
|
-
}
|
|
3319
|
-
case html.TAG_ID.NOFRAMES:
|
|
3320
|
-
{
|
|
3321
|
-
startTagInHead(p, token);
|
|
3322
|
-
break;
|
|
3323
|
-
}
|
|
3324
|
-
default:
|
|
3325
|
-
// Do nothing
|
|
3326
|
-
}
|
|
3327
|
-
}
|
|
3328
|
-
// The rules for parsing tokens in foreign content
|
|
3329
|
-
//------------------------------------------------------------------
|
|
3330
|
-
function nullCharacterInForeignContent(p, token) {
|
|
3331
|
-
token.chars = unicode.REPLACEMENT_CHARACTER;
|
|
3332
|
-
p._insertCharacters(token);
|
|
3333
|
-
}
|
|
3334
|
-
function characterInForeignContent(p, token) {
|
|
3335
|
-
p._insertCharacters(token);
|
|
3336
|
-
p.framesetOk = false;
|
|
3337
|
-
}
|
|
3338
|
-
function popUntilHtmlOrIntegrationPoint(p) {
|
|
3339
|
-
while (p.treeAdapter.getNamespaceURI(p.openElements.current) !== html.NS.HTML && !p._isIntegrationPoint(p.openElements.currentTagId, p.openElements.current)) {
|
|
3340
|
-
p.openElements.pop();
|
|
3341
|
-
}
|
|
3342
|
-
}
|
|
3343
|
-
function startTagInForeignContent(p, token) {
|
|
3344
|
-
if (foreignContent.causesExit(token)) {
|
|
3345
|
-
popUntilHtmlOrIntegrationPoint(p);
|
|
3346
|
-
p._startTagOutsideForeignContent(token);
|
|
3347
|
-
} else {
|
|
3348
|
-
const current = p._getAdjustedCurrentElement();
|
|
3349
|
-
const currentNs = p.treeAdapter.getNamespaceURI(current);
|
|
3350
|
-
if (currentNs === html.NS.MATHML) {
|
|
3351
|
-
foreignContent.adjustTokenMathMLAttrs(token);
|
|
3352
|
-
} else if (currentNs === html.NS.SVG) {
|
|
3353
|
-
foreignContent.adjustTokenSVGTagName(token);
|
|
3354
|
-
foreignContent.adjustTokenSVGAttrs(token);
|
|
3355
|
-
}
|
|
3356
|
-
foreignContent.adjustTokenXMLAttrs(token);
|
|
3357
|
-
if (token.selfClosing) {
|
|
3358
|
-
p._appendElement(token, currentNs);
|
|
3359
|
-
} else {
|
|
3360
|
-
p._insertElement(token, currentNs);
|
|
3361
|
-
}
|
|
3362
|
-
token.ackSelfClosing = true;
|
|
3363
|
-
}
|
|
3364
|
-
}
|
|
3365
|
-
function endTagInForeignContent(p, token) {
|
|
3366
|
-
if (token.tagID === html.TAG_ID.P || token.tagID === html.TAG_ID.BR) {
|
|
3367
|
-
popUntilHtmlOrIntegrationPoint(p);
|
|
3368
|
-
p._endTagOutsideForeignContent(token);
|
|
3369
|
-
return;
|
|
3370
|
-
}
|
|
3371
|
-
for (let i = p.openElements.stackTop; i > 0; i--) {
|
|
3372
|
-
const element = p.openElements.items[i];
|
|
3373
|
-
if (p.treeAdapter.getNamespaceURI(element) === html.NS.HTML) {
|
|
3374
|
-
p._endTagOutsideForeignContent(token);
|
|
3375
|
-
break;
|
|
3376
|
-
}
|
|
3377
|
-
const tagName = p.treeAdapter.getTagName(element);
|
|
3378
|
-
if (tagName.toLowerCase() === token.tagName) {
|
|
3379
|
-
//NOTE: update the token tag name for `_setEndLocation`.
|
|
3380
|
-
token.tagName = tagName;
|
|
3381
|
-
p.openElements.shortenToLength(i);
|
|
3382
|
-
break;
|
|
3383
|
-
}
|
|
3384
|
-
}
|
|
3385
|
-
}
|
|
3386
|
-
exports.Parser = Parser;
|
|
3387
|
-
//# sourceMappingURL=index.js.map
|