cloudstructs 0.9.19 → 0.9.21
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/.jsii +4 -4
- package/assets/slack-textract/detect.lambda/index.js +21 -10
- package/lib/codecommit-mirror/index.js +2 -2
- package/lib/dmarc/index.js +1 -1
- package/lib/ecs-service-roller/index.js +2 -2
- package/lib/email-receiver/receiver.js +1 -1
- package/lib/mjml-template/index.js +1 -1
- package/lib/saml-identity-provider/index.js +2 -2
- package/lib/slack-app/manifest.js +1 -1
- package/lib/slack-app/slack-app.js +2 -2
- package/lib/slack-events/index.js +1 -1
- package/lib/slack-textract/index.js +1 -1
- package/lib/ssl-server-test/index.js +1 -1
- package/lib/state-machine-cr-provider/index.js +1 -1
- package/lib/static-website/index.js +1 -1
- package/lib/toolkit-cleaner/index.js +1 -1
- package/lib/url-shortener/index.js +1 -1
- package/node_modules/@babel/runtime/helpers/esm/superPropGet.js +4 -4
- package/node_modules/@babel/runtime/helpers/esm/superPropSet.js +2 -2
- package/node_modules/@babel/runtime/helpers/superPropGet.js +4 -4
- package/node_modules/@babel/runtime/helpers/superPropSet.js +2 -2
- package/node_modules/@babel/runtime/package.json +1 -1
- package/node_modules/@slack/logger/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/logger/node_modules/@types/node/assert.d.ts +2 -2
- package/node_modules/@slack/logger/node_modules/@types/node/compatibility/disposable.d.ts +16 -0
- package/node_modules/@slack/logger/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/node_modules/@slack/logger/node_modules/@types/node/compatibility/indexable.d.ts +23 -0
- package/node_modules/@slack/logger/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
- package/node_modules/@slack/logger/node_modules/@types/node/crypto.d.ts +10 -9
- package/node_modules/@slack/logger/node_modules/@types/node/events.d.ts +2 -2
- package/node_modules/@slack/logger/node_modules/@types/node/fs/promises.d.ts +15 -4
- package/node_modules/@slack/logger/node_modules/@types/node/fs.d.ts +1 -1
- package/node_modules/@slack/logger/node_modules/@types/node/globals.d.ts +17 -48
- package/node_modules/@slack/logger/node_modules/@types/node/http.d.ts +37 -0
- package/node_modules/@slack/logger/node_modules/@types/node/index.d.ts +8 -10
- package/node_modules/@slack/logger/node_modules/@types/node/module.d.ts +91 -0
- package/node_modules/@slack/logger/node_modules/@types/node/package.json +4 -3
- package/node_modules/@slack/logger/node_modules/@types/node/perf_hooks.d.ts +24 -0
- package/node_modules/@slack/logger/node_modules/@types/node/readline/promises.d.ts +14 -2
- package/node_modules/@slack/logger/node_modules/@types/node/readline.d.ts +58 -9
- package/node_modules/@slack/logger/node_modules/@types/node/stream/promises.d.ts +8 -1
- package/node_modules/@slack/logger/node_modules/@types/node/stream/web.d.ts +5 -2
- package/node_modules/@slack/logger/node_modules/@types/node/stream.d.ts +2 -2
- package/node_modules/@slack/logger/node_modules/@types/node/test.d.ts +36 -5
- package/node_modules/@slack/logger/node_modules/@types/node/timers/promises.d.ts +1 -1
- package/node_modules/@slack/logger/node_modules/@types/node/tls.d.ts +6 -0
- package/node_modules/@slack/logger/node_modules/@types/node/ts5.6/index.d.ts +8 -10
- package/node_modules/@slack/logger/node_modules/@types/node/url.d.ts +7 -4
- package/node_modules/@slack/logger/node_modules/@types/node/util.d.ts +80 -10
- package/node_modules/@slack/logger/node_modules/@types/node/vm.d.ts +81 -27
- package/node_modules/@slack/logger/node_modules/@types/node/worker_threads.d.ts +1 -1
- package/node_modules/@slack/web-api/dist/WebClient.d.ts +36 -4
- package/node_modules/@slack/web-api/dist/WebClient.d.ts.map +1 -1
- package/node_modules/@slack/web-api/dist/WebClient.js +23 -10
- package/node_modules/@slack/web-api/dist/WebClient.js.map +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/assert.d.ts +2 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/compatibility/disposable.d.ts +16 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/compatibility/indexable.d.ts +23 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/crypto.d.ts +10 -9
- package/node_modules/@slack/web-api/node_modules/@types/node/events.d.ts +2 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/fs/promises.d.ts +15 -4
- package/node_modules/@slack/web-api/node_modules/@types/node/fs.d.ts +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/globals.d.ts +17 -48
- package/node_modules/@slack/web-api/node_modules/@types/node/http.d.ts +37 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/index.d.ts +8 -10
- package/node_modules/@slack/web-api/node_modules/@types/node/module.d.ts +91 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/package.json +4 -3
- package/node_modules/@slack/web-api/node_modules/@types/node/perf_hooks.d.ts +24 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/readline/promises.d.ts +14 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/readline.d.ts +58 -9
- package/node_modules/@slack/web-api/node_modules/@types/node/stream/promises.d.ts +8 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/stream/web.d.ts +5 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/stream.d.ts +2 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/test.d.ts +36 -5
- package/node_modules/@slack/web-api/node_modules/@types/node/timers/promises.d.ts +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/tls.d.ts +6 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/ts5.6/index.d.ts +8 -10
- package/node_modules/@slack/web-api/node_modules/@types/node/url.d.ts +7 -4
- package/node_modules/@slack/web-api/node_modules/@types/node/util.d.ts +80 -10
- package/node_modules/@slack/web-api/node_modules/@types/node/vm.d.ts +81 -27
- package/node_modules/@slack/web-api/node_modules/@types/node/worker_threads.d.ts +1 -1
- package/node_modules/@slack/web-api/package.json +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/assert.d.ts +2 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/compatibility/disposable.d.ts +16 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/compatibility/indexable.d.ts +23 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/crypto.d.ts +10 -9
- package/node_modules/@types/cacheable-request/node_modules/@types/node/events.d.ts +2 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/fs/promises.d.ts +15 -4
- package/node_modules/@types/cacheable-request/node_modules/@types/node/fs.d.ts +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.d.ts +17 -48
- package/node_modules/@types/cacheable-request/node_modules/@types/node/http.d.ts +37 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/index.d.ts +8 -10
- package/node_modules/@types/cacheable-request/node_modules/@types/node/module.d.ts +91 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/package.json +4 -3
- package/node_modules/@types/cacheable-request/node_modules/@types/node/perf_hooks.d.ts +24 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/readline/promises.d.ts +14 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/readline.d.ts +58 -9
- package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/promises.d.ts +8 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/web.d.ts +5 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/stream.d.ts +2 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/test.d.ts +36 -5
- package/node_modules/@types/cacheable-request/node_modules/@types/node/timers/promises.d.ts +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/tls.d.ts +6 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts5.6/index.d.ts +8 -10
- package/node_modules/@types/cacheable-request/node_modules/@types/node/url.d.ts +7 -4
- package/node_modules/@types/cacheable-request/node_modules/@types/node/util.d.ts +80 -10
- package/node_modules/@types/cacheable-request/node_modules/@types/node/vm.d.ts +81 -27
- package/node_modules/@types/cacheable-request/node_modules/@types/node/worker_threads.d.ts +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/assert.d.ts +2 -2
- package/node_modules/@types/keyv/node_modules/@types/node/compatibility/disposable.d.ts +16 -0
- package/node_modules/@types/keyv/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/node_modules/@types/keyv/node_modules/@types/node/compatibility/indexable.d.ts +23 -0
- package/node_modules/@types/keyv/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
- package/node_modules/@types/keyv/node_modules/@types/node/crypto.d.ts +10 -9
- package/node_modules/@types/keyv/node_modules/@types/node/events.d.ts +2 -2
- package/node_modules/@types/keyv/node_modules/@types/node/fs/promises.d.ts +15 -4
- package/node_modules/@types/keyv/node_modules/@types/node/fs.d.ts +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/globals.d.ts +17 -48
- package/node_modules/@types/keyv/node_modules/@types/node/http.d.ts +37 -0
- package/node_modules/@types/keyv/node_modules/@types/node/index.d.ts +8 -10
- package/node_modules/@types/keyv/node_modules/@types/node/module.d.ts +91 -0
- package/node_modules/@types/keyv/node_modules/@types/node/package.json +4 -3
- package/node_modules/@types/keyv/node_modules/@types/node/perf_hooks.d.ts +24 -0
- package/node_modules/@types/keyv/node_modules/@types/node/readline/promises.d.ts +14 -2
- package/node_modules/@types/keyv/node_modules/@types/node/readline.d.ts +58 -9
- package/node_modules/@types/keyv/node_modules/@types/node/stream/promises.d.ts +8 -1
- package/node_modules/@types/keyv/node_modules/@types/node/stream/web.d.ts +5 -2
- package/node_modules/@types/keyv/node_modules/@types/node/stream.d.ts +2 -2
- package/node_modules/@types/keyv/node_modules/@types/node/test.d.ts +36 -5
- package/node_modules/@types/keyv/node_modules/@types/node/timers/promises.d.ts +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/tls.d.ts +6 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts5.6/index.d.ts +8 -10
- package/node_modules/@types/keyv/node_modules/@types/node/url.d.ts +7 -4
- package/node_modules/@types/keyv/node_modules/@types/node/util.d.ts +80 -10
- package/node_modules/@types/keyv/node_modules/@types/node/vm.d.ts +81 -27
- package/node_modules/@types/keyv/node_modules/@types/node/worker_threads.d.ts +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/assert.d.ts +2 -2
- package/node_modules/@types/responselike/node_modules/@types/node/compatibility/disposable.d.ts +16 -0
- package/node_modules/@types/responselike/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/node_modules/@types/responselike/node_modules/@types/node/compatibility/indexable.d.ts +23 -0
- package/node_modules/@types/responselike/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
- package/node_modules/@types/responselike/node_modules/@types/node/crypto.d.ts +10 -9
- package/node_modules/@types/responselike/node_modules/@types/node/events.d.ts +2 -2
- package/node_modules/@types/responselike/node_modules/@types/node/fs/promises.d.ts +15 -4
- package/node_modules/@types/responselike/node_modules/@types/node/fs.d.ts +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/globals.d.ts +17 -48
- package/node_modules/@types/responselike/node_modules/@types/node/http.d.ts +37 -0
- package/node_modules/@types/responselike/node_modules/@types/node/index.d.ts +8 -10
- package/node_modules/@types/responselike/node_modules/@types/node/module.d.ts +91 -0
- package/node_modules/@types/responselike/node_modules/@types/node/package.json +4 -3
- package/node_modules/@types/responselike/node_modules/@types/node/perf_hooks.d.ts +24 -0
- package/node_modules/@types/responselike/node_modules/@types/node/readline/promises.d.ts +14 -2
- package/node_modules/@types/responselike/node_modules/@types/node/readline.d.ts +58 -9
- package/node_modules/@types/responselike/node_modules/@types/node/stream/promises.d.ts +8 -1
- package/node_modules/@types/responselike/node_modules/@types/node/stream/web.d.ts +5 -2
- package/node_modules/@types/responselike/node_modules/@types/node/stream.d.ts +2 -2
- package/node_modules/@types/responselike/node_modules/@types/node/test.d.ts +36 -5
- package/node_modules/@types/responselike/node_modules/@types/node/timers/promises.d.ts +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/tls.d.ts +6 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts5.6/index.d.ts +8 -10
- package/node_modules/@types/responselike/node_modules/@types/node/url.d.ts +7 -4
- package/node_modules/@types/responselike/node_modules/@types/node/util.d.ts +80 -10
- package/node_modules/@types/responselike/node_modules/@types/node/vm.d.ts +81 -27
- package/node_modules/@types/responselike/node_modules/@types/node/worker_threads.d.ts +1 -1
- package/node_modules/cross-spawn/README.md +3 -10
- package/node_modules/cross-spawn/lib/enoent.js +1 -1
- package/node_modules/cross-spawn/lib/util/escape.js +4 -2
- package/node_modules/cross-spawn/package.json +1 -1
- package/node_modules/form-data/Readme.md +4 -4
- package/node_modules/form-data/lib/form_data.js +1 -1
- package/node_modules/form-data/package.json +9 -6
- package/node_modules/parse5/dist/cjs/common/doctype.d.ts +0 -1
- package/node_modules/parse5/dist/cjs/common/doctype.js +2 -4
- package/node_modules/parse5/dist/cjs/common/error-codes.d.ts +0 -1
- package/node_modules/parse5/dist/cjs/common/error-codes.js +1 -2
- package/node_modules/parse5/dist/cjs/common/foreign-content.d.ts +0 -1
- package/node_modules/parse5/dist/cjs/common/foreign-content.js +7 -9
- package/node_modules/parse5/dist/cjs/common/html.d.ts +32 -31
- package/node_modules/parse5/dist/cjs/common/html.js +41 -42
- package/node_modules/parse5/dist/cjs/common/token.d.ts +0 -1
- package/node_modules/parse5/dist/cjs/common/token.js +3 -4
- package/node_modules/parse5/dist/cjs/common/unicode.d.ts +1 -8
- package/node_modules/parse5/dist/cjs/common/unicode.js +7 -14
- package/node_modules/parse5/dist/cjs/index.d.ts +15 -4
- package/node_modules/parse5/dist/cjs/index.js +3 -6
- package/node_modules/parse5/dist/cjs/parser/formatting-element-list.d.ts +0 -1
- package/node_modules/parse5/dist/cjs/parser/formatting-element-list.js +1 -2
- package/node_modules/parse5/dist/cjs/parser/index.d.ts +72 -8
- package/node_modules/parse5/dist/cjs/parser/index.js +81 -9
- package/node_modules/parse5/dist/cjs/parser/open-element-stack.d.ts +2 -2
- package/node_modules/parse5/dist/cjs/parser/open-element-stack.js +95 -87
- package/node_modules/parse5/dist/cjs/serializer/index.d.ts +1 -2
- package/node_modules/parse5/dist/cjs/serializer/index.js +8 -9
- package/node_modules/parse5/dist/cjs/tokenizer/index.d.ts +130 -131
- package/node_modules/parse5/dist/cjs/tokenizer/index.js +87 -281
- package/node_modules/parse5/dist/cjs/tokenizer/preprocessor.d.ts +3 -4
- package/node_modules/parse5/dist/cjs/tokenizer/preprocessor.js +8 -7
- package/node_modules/parse5/dist/cjs/tree-adapters/default.d.ts +0 -1
- package/node_modules/parse5/dist/cjs/tree-adapters/default.js +9 -10
- package/node_modules/parse5/dist/cjs/tree-adapters/interface.d.ts +7 -2
- package/node_modules/parse5/dist/cjs/tree-adapters/interface.js +0 -1
- package/node_modules/parse5/dist/common/doctype.d.ts +0 -1
- package/node_modules/parse5/dist/common/doctype.js +0 -1
- package/node_modules/parse5/dist/common/error-codes.d.ts +0 -1
- package/node_modules/parse5/dist/common/error-codes.js +1 -2
- package/node_modules/parse5/dist/common/foreign-content.d.ts +0 -1
- package/node_modules/parse5/dist/common/foreign-content.js +0 -2
- package/node_modules/parse5/dist/common/html.d.ts +32 -31
- package/node_modules/parse5/dist/common/html.js +38 -38
- package/node_modules/parse5/dist/common/token.d.ts +0 -1
- package/node_modules/parse5/dist/common/token.js +1 -2
- package/node_modules/parse5/dist/common/unicode.d.ts +1 -8
- package/node_modules/parse5/dist/common/unicode.js +1 -8
- package/node_modules/parse5/dist/index.d.ts +15 -4
- package/node_modules/parse5/dist/index.js +0 -3
- package/node_modules/parse5/dist/parser/formatting-element-list.d.ts +0 -1
- package/node_modules/parse5/dist/parser/formatting-element-list.js +1 -2
- package/node_modules/parse5/dist/parser/index.d.ts +72 -8
- package/node_modules/parse5/dist/parser/index.js +82 -10
- package/node_modules/parse5/dist/parser/open-element-stack.d.ts +2 -2
- package/node_modules/parse5/dist/parser/open-element-stack.js +96 -88
- package/node_modules/parse5/dist/serializer/index.d.ts +1 -2
- package/node_modules/parse5/dist/serializer/index.js +6 -6
- package/node_modules/parse5/dist/tokenizer/index.d.ts +130 -131
- package/node_modules/parse5/dist/tokenizer/index.js +88 -282
- package/node_modules/parse5/dist/tokenizer/preprocessor.d.ts +3 -4
- package/node_modules/parse5/dist/tokenizer/preprocessor.js +8 -7
- package/node_modules/parse5/dist/tree-adapters/default.d.ts +0 -1
- package/node_modules/parse5/dist/tree-adapters/default.js +9 -10
- package/node_modules/parse5/dist/tree-adapters/interface.d.ts +7 -2
- package/node_modules/parse5/dist/tree-adapters/interface.js +0 -1
- package/node_modules/parse5/package.json +4 -4
- package/node_modules/parse5-htmlparser2-tree-adapter/dist/cjs/index.d.ts +1 -2
- package/node_modules/parse5-htmlparser2-tree-adapter/dist/cjs/index.js +11 -12
- package/node_modules/parse5-htmlparser2-tree-adapter/dist/index.d.ts +1 -2
- package/node_modules/parse5-htmlparser2-tree-adapter/dist/index.js +9 -10
- package/node_modules/parse5-htmlparser2-tree-adapter/package.json +7 -6
- package/package.json +21 -20
- package/node_modules/@slack/logger/node_modules/@types/node/globals.global.d.ts +0 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/globals.global.d.ts +0 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.global.d.ts +0 -1
- package/node_modules/@types/keyv/node_modules/@types/node/globals.global.d.ts +0 -1
- package/node_modules/@types/responselike/node_modules/@types/node/globals.global.d.ts +0 -1
- package/node_modules/form-data/README.md.bak +0 -358
|
@@ -6,7 +6,7 @@ import * as doctype from '../common/doctype.js';
|
|
|
6
6
|
import * as foreignContent from '../common/foreign-content.js';
|
|
7
7
|
import { ERR } from '../common/error-codes.js';
|
|
8
8
|
import * as unicode from '../common/unicode.js';
|
|
9
|
-
import { TAG_ID as $, TAG_NAMES as TN, NS, ATTRS, SPECIAL_ELEMENTS, DOCUMENT_MODE,
|
|
9
|
+
import { TAG_ID as $, TAG_NAMES as TN, NS, ATTRS, SPECIAL_ELEMENTS, DOCUMENT_MODE, NUMBERED_HEADERS, getTagID, } from '../common/html.js';
|
|
10
10
|
import { TokenType, getTokenAttr, } from '../common/token.js';
|
|
11
11
|
//Misc constants
|
|
12
12
|
const HIDDEN_INPUT_TYPE = 'hidden';
|
|
@@ -57,26 +57,41 @@ const defaultParserOptions = {
|
|
|
57
57
|
};
|
|
58
58
|
//Parser
|
|
59
59
|
export class Parser {
|
|
60
|
-
constructor(options, document,
|
|
60
|
+
constructor(options, document,
|
|
61
|
+
/** @internal */
|
|
62
|
+
fragmentContext = null,
|
|
63
|
+
/** @internal */
|
|
64
|
+
scriptHandler = null) {
|
|
61
65
|
this.fragmentContext = fragmentContext;
|
|
62
66
|
this.scriptHandler = scriptHandler;
|
|
63
67
|
this.currentToken = null;
|
|
64
68
|
this.stopped = false;
|
|
69
|
+
/** @internal */
|
|
65
70
|
this.insertionMode = InsertionMode.INITIAL;
|
|
71
|
+
/** @internal */
|
|
66
72
|
this.originalInsertionMode = InsertionMode.INITIAL;
|
|
73
|
+
/** @internal */
|
|
67
74
|
this.headElement = null;
|
|
75
|
+
/** @internal */
|
|
68
76
|
this.formElement = null;
|
|
69
77
|
/** Indicates that the current node is not an element in the HTML namespace */
|
|
70
78
|
this.currentNotInHTML = false;
|
|
71
79
|
/**
|
|
72
80
|
* The template insertion mode stack is maintained from the left.
|
|
73
81
|
* Ie. the topmost element will always have index 0.
|
|
82
|
+
*
|
|
83
|
+
* @internal
|
|
74
84
|
*/
|
|
75
85
|
this.tmplInsertionModeStack = [];
|
|
86
|
+
/** @internal */
|
|
76
87
|
this.pendingCharacterTokens = [];
|
|
88
|
+
/** @internal */
|
|
77
89
|
this.hasNonWhitespacePendingCharacterToken = false;
|
|
90
|
+
/** @internal */
|
|
78
91
|
this.framesetOk = true;
|
|
92
|
+
/** @internal */
|
|
79
93
|
this.skipNextNewLine = false;
|
|
94
|
+
/** @internal */
|
|
80
95
|
this.fosterParentingEnabled = false;
|
|
81
96
|
this.options = {
|
|
82
97
|
...defaultParserOptions,
|
|
@@ -130,6 +145,7 @@ export class Parser {
|
|
|
130
145
|
return fragment;
|
|
131
146
|
}
|
|
132
147
|
//Errors
|
|
148
|
+
/** @internal */
|
|
133
149
|
_err(token, code, beforeToken) {
|
|
134
150
|
var _a;
|
|
135
151
|
if (!this.onParseError)
|
|
@@ -147,12 +163,14 @@ export class Parser {
|
|
|
147
163
|
this.onParseError(err);
|
|
148
164
|
}
|
|
149
165
|
//Stack events
|
|
166
|
+
/** @internal */
|
|
150
167
|
onItemPush(node, tid, isTop) {
|
|
151
168
|
var _a, _b;
|
|
152
169
|
(_b = (_a = this.treeAdapter).onItemPush) === null || _b === void 0 ? void 0 : _b.call(_a, node);
|
|
153
170
|
if (isTop && this.openElements.stackTop > 0)
|
|
154
171
|
this._setContextModes(node, tid);
|
|
155
172
|
}
|
|
173
|
+
/** @internal */
|
|
156
174
|
onItemPop(node, isTop) {
|
|
157
175
|
var _a, _b;
|
|
158
176
|
if (this.options.sourceCodeLocationInfo) {
|
|
@@ -177,6 +195,7 @@ export class Parser {
|
|
|
177
195
|
this.currentNotInHTML = !isHTML;
|
|
178
196
|
this.tokenizer.inForeignNode = !isHTML && !this._isIntegrationPoint(tid, current);
|
|
179
197
|
}
|
|
198
|
+
/** @protected */
|
|
180
199
|
_switchToTextParsing(currentToken, nextTokenizerState) {
|
|
181
200
|
this._insertElement(currentToken, NS.HTML);
|
|
182
201
|
this.tokenizer.state = nextTokenizerState;
|
|
@@ -189,11 +208,13 @@ export class Parser {
|
|
|
189
208
|
this.tokenizer.state = TokenizerMode.PLAINTEXT;
|
|
190
209
|
}
|
|
191
210
|
//Fragment parsing
|
|
211
|
+
/** @protected */
|
|
192
212
|
_getAdjustedCurrentElement() {
|
|
193
213
|
return this.openElements.stackTop === 0 && this.fragmentContext
|
|
194
214
|
? this.fragmentContext
|
|
195
215
|
: this.openElements.current;
|
|
196
216
|
}
|
|
217
|
+
/** @protected */
|
|
197
218
|
_findFormInFragmentContext() {
|
|
198
219
|
let node = this.fragmentContext;
|
|
199
220
|
while (node) {
|
|
@@ -236,6 +257,7 @@ export class Parser {
|
|
|
236
257
|
}
|
|
237
258
|
}
|
|
238
259
|
//Tree mutation
|
|
260
|
+
/** @protected */
|
|
239
261
|
_setDocumentType(token) {
|
|
240
262
|
const name = token.name || '';
|
|
241
263
|
const publicId = token.publicId || '';
|
|
@@ -249,6 +271,7 @@ export class Parser {
|
|
|
249
271
|
}
|
|
250
272
|
}
|
|
251
273
|
}
|
|
274
|
+
/** @protected */
|
|
252
275
|
_attachElementToTree(element, location) {
|
|
253
276
|
if (this.options.sourceCodeLocationInfo) {
|
|
254
277
|
const loc = location && {
|
|
@@ -265,20 +288,28 @@ export class Parser {
|
|
|
265
288
|
this.treeAdapter.appendChild(parent, element);
|
|
266
289
|
}
|
|
267
290
|
}
|
|
291
|
+
/**
|
|
292
|
+
* For self-closing tags. Add an element to the tree, but skip adding it
|
|
293
|
+
* to the stack.
|
|
294
|
+
*/
|
|
295
|
+
/** @protected */
|
|
268
296
|
_appendElement(token, namespaceURI) {
|
|
269
297
|
const element = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs);
|
|
270
298
|
this._attachElementToTree(element, token.location);
|
|
271
299
|
}
|
|
300
|
+
/** @protected */
|
|
272
301
|
_insertElement(token, namespaceURI) {
|
|
273
302
|
const element = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs);
|
|
274
303
|
this._attachElementToTree(element, token.location);
|
|
275
304
|
this.openElements.push(element, token.tagID);
|
|
276
305
|
}
|
|
306
|
+
/** @protected */
|
|
277
307
|
_insertFakeElement(tagName, tagID) {
|
|
278
308
|
const element = this.treeAdapter.createElement(tagName, NS.HTML, []);
|
|
279
309
|
this._attachElementToTree(element, null);
|
|
280
310
|
this.openElements.push(element, tagID);
|
|
281
311
|
}
|
|
312
|
+
/** @protected */
|
|
282
313
|
_insertTemplate(token) {
|
|
283
314
|
const tmpl = this.treeAdapter.createElement(token.tagName, NS.HTML, token.attrs);
|
|
284
315
|
const content = this.treeAdapter.createDocumentFragment();
|
|
@@ -288,6 +319,7 @@ export class Parser {
|
|
|
288
319
|
if (this.options.sourceCodeLocationInfo)
|
|
289
320
|
this.treeAdapter.setNodeSourceCodeLocation(content, null);
|
|
290
321
|
}
|
|
322
|
+
/** @protected */
|
|
291
323
|
_insertFakeRootElement() {
|
|
292
324
|
const element = this.treeAdapter.createElement(TN.HTML, NS.HTML, []);
|
|
293
325
|
if (this.options.sourceCodeLocationInfo)
|
|
@@ -295,6 +327,7 @@ export class Parser {
|
|
|
295
327
|
this.treeAdapter.appendChild(this.openElements.current, element);
|
|
296
328
|
this.openElements.push(element, $.HTML);
|
|
297
329
|
}
|
|
330
|
+
/** @protected */
|
|
298
331
|
_appendCommentNode(token, parent) {
|
|
299
332
|
const commentNode = this.treeAdapter.createCommentNode(token.data);
|
|
300
333
|
this.treeAdapter.appendChild(parent, commentNode);
|
|
@@ -302,6 +335,7 @@ export class Parser {
|
|
|
302
335
|
this.treeAdapter.setNodeSourceCodeLocation(commentNode, token.location);
|
|
303
336
|
}
|
|
304
337
|
}
|
|
338
|
+
/** @protected */
|
|
305
339
|
_insertCharacters(token) {
|
|
306
340
|
let parent;
|
|
307
341
|
let beforeElement;
|
|
@@ -333,12 +367,14 @@ export class Parser {
|
|
|
333
367
|
this.treeAdapter.setNodeSourceCodeLocation(textNode, token.location);
|
|
334
368
|
}
|
|
335
369
|
}
|
|
370
|
+
/** @protected */
|
|
336
371
|
_adoptNodes(donor, recipient) {
|
|
337
372
|
for (let child = this.treeAdapter.getFirstChild(donor); child; child = this.treeAdapter.getFirstChild(donor)) {
|
|
338
373
|
this.treeAdapter.detachNode(child);
|
|
339
374
|
this.treeAdapter.appendChild(recipient, child);
|
|
340
375
|
}
|
|
341
376
|
}
|
|
377
|
+
/** @protected */
|
|
342
378
|
_setEndLocation(element, closingToken) {
|
|
343
379
|
if (this.treeAdapter.getNodeSourceCodeLocation(element) && closingToken.location) {
|
|
344
380
|
const ctLoc = closingToken.location;
|
|
@@ -388,6 +424,7 @@ export class Parser {
|
|
|
388
424
|
((token.tagID === $.MGLYPH || token.tagID === $.MALIGNMARK) &&
|
|
389
425
|
!this._isIntegrationPoint(currentTagId, current, NS.HTML)));
|
|
390
426
|
}
|
|
427
|
+
/** @protected */
|
|
391
428
|
_processToken(token) {
|
|
392
429
|
switch (token.type) {
|
|
393
430
|
case TokenType.CHARACTER: {
|
|
@@ -425,12 +462,14 @@ export class Parser {
|
|
|
425
462
|
}
|
|
426
463
|
}
|
|
427
464
|
//Integration points
|
|
465
|
+
/** @protected */
|
|
428
466
|
_isIntegrationPoint(tid, element, foreignNS) {
|
|
429
467
|
const ns = this.treeAdapter.getNamespaceURI(element);
|
|
430
468
|
const attrs = this.treeAdapter.getAttrList(element);
|
|
431
469
|
return foreignContent.isIntegrationPoint(tid, ns, attrs, foreignNS);
|
|
432
470
|
}
|
|
433
471
|
//Active formatting elements reconstruction
|
|
472
|
+
/** @protected */
|
|
434
473
|
_reconstructActiveFormattingElements() {
|
|
435
474
|
const listLength = this.activeFormattingElements.entries.length;
|
|
436
475
|
if (listLength) {
|
|
@@ -444,17 +483,20 @@ export class Parser {
|
|
|
444
483
|
}
|
|
445
484
|
}
|
|
446
485
|
//Close elements
|
|
486
|
+
/** @protected */
|
|
447
487
|
_closeTableCell() {
|
|
448
488
|
this.openElements.generateImpliedEndTags();
|
|
449
489
|
this.openElements.popUntilTableCellPopped();
|
|
450
490
|
this.activeFormattingElements.clearToLastMarker();
|
|
451
491
|
this.insertionMode = InsertionMode.IN_ROW;
|
|
452
492
|
}
|
|
493
|
+
/** @protected */
|
|
453
494
|
_closePElement() {
|
|
454
495
|
this.openElements.generateImpliedEndTagsWithExclusion($.P);
|
|
455
496
|
this.openElements.popUntilTagNamePopped($.P);
|
|
456
497
|
}
|
|
457
498
|
//Insertion modes
|
|
499
|
+
/** @protected */
|
|
458
500
|
_resetInsertionMode() {
|
|
459
501
|
for (let i = this.openElements.stackTop; i >= 0; i--) {
|
|
460
502
|
//Insertion mode reset map
|
|
@@ -520,6 +562,7 @@ export class Parser {
|
|
|
520
562
|
}
|
|
521
563
|
this.insertionMode = InsertionMode.IN_BODY;
|
|
522
564
|
}
|
|
565
|
+
/** @protected */
|
|
523
566
|
_resetInsertionModeForSelect(selectIdx) {
|
|
524
567
|
if (selectIdx > 0) {
|
|
525
568
|
for (let i = selectIdx - 1; i > 0; i--) {
|
|
@@ -536,12 +579,15 @@ export class Parser {
|
|
|
536
579
|
this.insertionMode = InsertionMode.IN_SELECT;
|
|
537
580
|
}
|
|
538
581
|
//Foster parenting
|
|
582
|
+
/** @protected */
|
|
539
583
|
_isElementCausesFosterParenting(tn) {
|
|
540
584
|
return TABLE_STRUCTURE_TAGS.has(tn);
|
|
541
585
|
}
|
|
586
|
+
/** @protected */
|
|
542
587
|
_shouldFosterParentOnInsertion() {
|
|
543
588
|
return this.fosterParentingEnabled && this._isElementCausesFosterParenting(this.openElements.currentTagId);
|
|
544
589
|
}
|
|
590
|
+
/** @protected */
|
|
545
591
|
_findFosterParentingLocation() {
|
|
546
592
|
for (let i = this.openElements.stackTop; i >= 0; i--) {
|
|
547
593
|
const openElement = this.openElements.items[i];
|
|
@@ -565,6 +611,7 @@ export class Parser {
|
|
|
565
611
|
}
|
|
566
612
|
return { parent: this.openElements.items[0], beforeElement: null };
|
|
567
613
|
}
|
|
614
|
+
/** @protected */
|
|
568
615
|
_fosterParentElement(element) {
|
|
569
616
|
const location = this._findFosterParentingLocation();
|
|
570
617
|
if (location.beforeElement) {
|
|
@@ -575,10 +622,12 @@ export class Parser {
|
|
|
575
622
|
}
|
|
576
623
|
}
|
|
577
624
|
//Special elements
|
|
625
|
+
/** @protected */
|
|
578
626
|
_isSpecialElement(element, id) {
|
|
579
627
|
const ns = this.treeAdapter.getNamespaceURI(element);
|
|
580
628
|
return SPECIAL_ELEMENTS[ns].has(id);
|
|
581
629
|
}
|
|
630
|
+
/** @internal */
|
|
582
631
|
onCharacter(token) {
|
|
583
632
|
this.skipNextNewLine = false;
|
|
584
633
|
if (this.tokenizer.inForeignNode) {
|
|
@@ -649,6 +698,7 @@ export class Parser {
|
|
|
649
698
|
// Do nothing
|
|
650
699
|
}
|
|
651
700
|
}
|
|
701
|
+
/** @internal */
|
|
652
702
|
onNullCharacter(token) {
|
|
653
703
|
this.skipNextNewLine = false;
|
|
654
704
|
if (this.tokenizer.inForeignNode) {
|
|
@@ -706,6 +756,7 @@ export class Parser {
|
|
|
706
756
|
// Do nothing
|
|
707
757
|
}
|
|
708
758
|
}
|
|
759
|
+
/** @internal */
|
|
709
760
|
onComment(token) {
|
|
710
761
|
this.skipNextNewLine = false;
|
|
711
762
|
if (this.currentNotInHTML) {
|
|
@@ -751,6 +802,7 @@ export class Parser {
|
|
|
751
802
|
// Do nothing
|
|
752
803
|
}
|
|
753
804
|
}
|
|
805
|
+
/** @internal */
|
|
754
806
|
onDoctype(token) {
|
|
755
807
|
this.skipNextNewLine = false;
|
|
756
808
|
switch (this.insertionMode) {
|
|
@@ -773,6 +825,7 @@ export class Parser {
|
|
|
773
825
|
// Do nothing
|
|
774
826
|
}
|
|
775
827
|
}
|
|
828
|
+
/** @internal */
|
|
776
829
|
onStartTag(token) {
|
|
777
830
|
this.skipNextNewLine = false;
|
|
778
831
|
this.currentToken = token;
|
|
@@ -790,6 +843,7 @@ export class Parser {
|
|
|
790
843
|
* for nested calls.
|
|
791
844
|
*
|
|
792
845
|
* @param token The token to process.
|
|
846
|
+
* @protected
|
|
793
847
|
*/
|
|
794
848
|
_processStartTag(token) {
|
|
795
849
|
if (this.shouldProcessStartTagTokenInForeignContent(token)) {
|
|
@@ -799,6 +853,7 @@ export class Parser {
|
|
|
799
853
|
this._startTagOutsideForeignContent(token);
|
|
800
854
|
}
|
|
801
855
|
}
|
|
856
|
+
/** @protected */
|
|
802
857
|
_startTagOutsideForeignContent(token) {
|
|
803
858
|
switch (this.insertionMode) {
|
|
804
859
|
case InsertionMode.INITIAL: {
|
|
@@ -893,6 +948,7 @@ export class Parser {
|
|
|
893
948
|
// Do nothing
|
|
894
949
|
}
|
|
895
950
|
}
|
|
951
|
+
/** @internal */
|
|
896
952
|
onEndTag(token) {
|
|
897
953
|
this.skipNextNewLine = false;
|
|
898
954
|
this.currentToken = token;
|
|
@@ -903,6 +959,7 @@ export class Parser {
|
|
|
903
959
|
this._endTagOutsideForeignContent(token);
|
|
904
960
|
}
|
|
905
961
|
}
|
|
962
|
+
/** @protected */
|
|
906
963
|
_endTagOutsideForeignContent(token) {
|
|
907
964
|
switch (this.insertionMode) {
|
|
908
965
|
case InsertionMode.INITIAL: {
|
|
@@ -997,6 +1054,7 @@ export class Parser {
|
|
|
997
1054
|
// Do nothing
|
|
998
1055
|
}
|
|
999
1056
|
}
|
|
1057
|
+
/** @internal */
|
|
1000
1058
|
onEof(token) {
|
|
1001
1059
|
switch (this.insertionMode) {
|
|
1002
1060
|
case InsertionMode.INITIAL: {
|
|
@@ -1059,6 +1117,7 @@ export class Parser {
|
|
|
1059
1117
|
// Do nothing
|
|
1060
1118
|
}
|
|
1061
1119
|
}
|
|
1120
|
+
/** @internal */
|
|
1062
1121
|
onWhitespaceCharacter(token) {
|
|
1063
1122
|
if (this.skipNextNewLine) {
|
|
1064
1123
|
this.skipNextNewLine = false;
|
|
@@ -1631,7 +1690,7 @@ function numberedHeaderStartTagInBody(p, token) {
|
|
|
1631
1690
|
if (p.openElements.hasInButtonScope($.P)) {
|
|
1632
1691
|
p._closePElement();
|
|
1633
1692
|
}
|
|
1634
|
-
if (
|
|
1693
|
+
if (NUMBERED_HEADERS.has(p.openElements.currentTagId)) {
|
|
1635
1694
|
p.openElements.pop();
|
|
1636
1695
|
}
|
|
1637
1696
|
p._insertElement(token, NS.HTML);
|
|
@@ -1793,9 +1852,9 @@ function iframeStartTagInBody(p, token) {
|
|
|
1793
1852
|
p.framesetOk = false;
|
|
1794
1853
|
p._switchToTextParsing(token, TokenizerMode.RAWTEXT);
|
|
1795
1854
|
}
|
|
1796
|
-
//NOTE: here we assume that we always act as
|
|
1797
|
-
//<noembed> as rawtext.
|
|
1798
|
-
function
|
|
1855
|
+
//NOTE: here we assume that we always act as a user agent with enabled plugins/frames, so we parse
|
|
1856
|
+
//<noembed>/<noframes> as rawtext.
|
|
1857
|
+
function rawTextStartTagInBody(p, token) {
|
|
1799
1858
|
p._switchToTextParsing(token, TokenizerMode.RAWTEXT);
|
|
1800
1859
|
}
|
|
1801
1860
|
function selectStartTagInBody(p, token) {
|
|
@@ -1907,6 +1966,7 @@ function startTagInBody(p, token) {
|
|
|
1907
1966
|
case $.DETAILS:
|
|
1908
1967
|
case $.ADDRESS:
|
|
1909
1968
|
case $.ARTICLE:
|
|
1969
|
+
case $.SEARCH:
|
|
1910
1970
|
case $.SECTION:
|
|
1911
1971
|
case $.SUMMARY:
|
|
1912
1972
|
case $.FIELDSET:
|
|
@@ -2030,8 +2090,9 @@ function startTagInBody(p, token) {
|
|
|
2030
2090
|
optgroupStartTagInBody(p, token);
|
|
2031
2091
|
break;
|
|
2032
2092
|
}
|
|
2033
|
-
case $.NOEMBED:
|
|
2034
|
-
|
|
2093
|
+
case $.NOEMBED:
|
|
2094
|
+
case $.NOFRAMES: {
|
|
2095
|
+
rawTextStartTagInBody(p, token);
|
|
2035
2096
|
break;
|
|
2036
2097
|
}
|
|
2037
2098
|
case $.FRAMESET: {
|
|
@@ -2044,7 +2105,7 @@ function startTagInBody(p, token) {
|
|
|
2044
2105
|
}
|
|
2045
2106
|
case $.NOSCRIPT: {
|
|
2046
2107
|
if (p.options.scriptingEnabled) {
|
|
2047
|
-
|
|
2108
|
+
rawTextStartTagInBody(p, token);
|
|
2048
2109
|
}
|
|
2049
2110
|
else {
|
|
2050
2111
|
genericStartTagInBody(p, token);
|
|
@@ -2216,6 +2277,7 @@ function endTagInBody(p, token) {
|
|
|
2216
2277
|
case $.ADDRESS:
|
|
2217
2278
|
case $.ARTICLE:
|
|
2218
2279
|
case $.DETAILS:
|
|
2280
|
+
case $.SEARCH:
|
|
2219
2281
|
case $.SECTION:
|
|
2220
2282
|
case $.SUMMARY:
|
|
2221
2283
|
case $.LISTING:
|
|
@@ -2816,6 +2878,17 @@ function startTagInSelect(p, token) {
|
|
|
2816
2878
|
p._insertElement(token, NS.HTML);
|
|
2817
2879
|
break;
|
|
2818
2880
|
}
|
|
2881
|
+
case $.HR: {
|
|
2882
|
+
if (p.openElements.currentTagId === $.OPTION) {
|
|
2883
|
+
p.openElements.pop();
|
|
2884
|
+
}
|
|
2885
|
+
if (p.openElements.currentTagId === $.OPTGROUP) {
|
|
2886
|
+
p.openElements.pop();
|
|
2887
|
+
}
|
|
2888
|
+
p._appendElement(token, NS.HTML);
|
|
2889
|
+
token.ackSelfClosing = true;
|
|
2890
|
+
break;
|
|
2891
|
+
}
|
|
2819
2892
|
case $.INPUT:
|
|
2820
2893
|
case $.KEYGEN:
|
|
2821
2894
|
case $.TEXTAREA:
|
|
@@ -3165,4 +3238,3 @@ function endTagInForeignContent(p, token) {
|
|
|
3165
3238
|
}
|
|
3166
3239
|
}
|
|
3167
3240
|
}
|
|
3168
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -39,10 +39,11 @@ export declare class OpenElementStack<T extends TreeAdapterTypeMap> {
|
|
|
39
39
|
contains(element: T['element']): boolean;
|
|
40
40
|
getCommonAncestor(element: T['element']): T['element'] | null;
|
|
41
41
|
isRootHtmlElementCurrent(): boolean;
|
|
42
|
+
private hasInDynamicScope;
|
|
42
43
|
hasInScope(tagName: $): boolean;
|
|
43
|
-
hasNumberedHeaderInScope(): boolean;
|
|
44
44
|
hasInListItemScope(tagName: $): boolean;
|
|
45
45
|
hasInButtonScope(tagName: $): boolean;
|
|
46
|
+
hasNumberedHeaderInScope(): boolean;
|
|
46
47
|
hasInTableScope(tagName: $): boolean;
|
|
47
48
|
hasTableBodyContextInTableScope(): boolean;
|
|
48
49
|
hasInSelectScope(tagName: $): boolean;
|
|
@@ -50,4 +51,3 @@ export declare class OpenElementStack<T extends TreeAdapterTypeMap> {
|
|
|
50
51
|
generateImpliedEndTagsThoroughly(): void;
|
|
51
52
|
generateImpliedEndTagsWithExclusion(exclusionId: $): void;
|
|
52
53
|
}
|
|
53
|
-
//# sourceMappingURL=open-element-stack.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TAG_ID as $, NS,
|
|
1
|
+
import { TAG_ID as $, NS, NUMBERED_HEADERS } from '../common/html.js';
|
|
2
2
|
//Element utils
|
|
3
3
|
const IMPLICIT_END_TAG_REQUIRED = new Set([$.DD, $.DT, $.LI, $.OPTGROUP, $.OPTION, $.P, $.RB, $.RP, $.RT, $.RTC]);
|
|
4
4
|
const IMPLICIT_END_TAG_REQUIRED_THOROUGHLY = new Set([
|
|
@@ -12,31 +12,25 @@ const IMPLICIT_END_TAG_REQUIRED_THOROUGHLY = new Set([
|
|
|
12
12
|
$.THEAD,
|
|
13
13
|
$.TR,
|
|
14
14
|
]);
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
[$.ANNOTATION_XML, NS.MATHML],
|
|
26
|
-
[$.MI, NS.MATHML],
|
|
27
|
-
[$.MN, NS.MATHML],
|
|
28
|
-
[$.MO, NS.MATHML],
|
|
29
|
-
[$.MS, NS.MATHML],
|
|
30
|
-
[$.MTEXT, NS.MATHML],
|
|
31
|
-
[$.DESC, NS.SVG],
|
|
32
|
-
[$.FOREIGN_OBJECT, NS.SVG],
|
|
33
|
-
[$.TITLE, NS.SVG],
|
|
15
|
+
const SCOPING_ELEMENTS_HTML = new Set([
|
|
16
|
+
$.APPLET,
|
|
17
|
+
$.CAPTION,
|
|
18
|
+
$.HTML,
|
|
19
|
+
$.MARQUEE,
|
|
20
|
+
$.OBJECT,
|
|
21
|
+
$.TABLE,
|
|
22
|
+
$.TD,
|
|
23
|
+
$.TEMPLATE,
|
|
24
|
+
$.TH,
|
|
34
25
|
]);
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
26
|
+
const SCOPING_ELEMENTS_HTML_LIST = new Set([...SCOPING_ELEMENTS_HTML, $.OL, $.UL]);
|
|
27
|
+
const SCOPING_ELEMENTS_HTML_BUTTON = new Set([...SCOPING_ELEMENTS_HTML, $.BUTTON]);
|
|
28
|
+
const SCOPING_ELEMENTS_MATHML = new Set([$.ANNOTATION_XML, $.MI, $.MN, $.MO, $.MS, $.MTEXT]);
|
|
29
|
+
const SCOPING_ELEMENTS_SVG = new Set([$.DESC, $.FOREIGN_OBJECT, $.TITLE]);
|
|
30
|
+
const TABLE_ROW_CONTEXT = new Set([$.TR, $.TEMPLATE, $.HTML]);
|
|
31
|
+
const TABLE_BODY_CONTEXT = new Set([$.TBODY, $.TFOOT, $.THEAD, $.TEMPLATE, $.HTML]);
|
|
32
|
+
const TABLE_CONTEXT = new Set([$.TABLE, $.TEMPLATE, $.HTML]);
|
|
33
|
+
const TABLE_CELLS = new Set([$.TD, $.TH]);
|
|
40
34
|
//Stack of open elements
|
|
41
35
|
export class OpenElementStack {
|
|
42
36
|
get currentTmplContentOrNode() {
|
|
@@ -129,7 +123,7 @@ export class OpenElementStack {
|
|
|
129
123
|
this.shortenToLength(idx < 0 ? 0 : idx);
|
|
130
124
|
}
|
|
131
125
|
popUntilNumberedHeaderPopped() {
|
|
132
|
-
this.popUntilPopped(
|
|
126
|
+
this.popUntilPopped(NUMBERED_HEADERS, NS.HTML);
|
|
133
127
|
}
|
|
134
128
|
popUntilTableCellPopped() {
|
|
135
129
|
this.popUntilPopped(TABLE_CELLS, NS.HTML);
|
|
@@ -142,7 +136,7 @@ export class OpenElementStack {
|
|
|
142
136
|
}
|
|
143
137
|
_indexOfTagNames(tagNames, namespace) {
|
|
144
138
|
for (let i = this.stackTop; i >= 0; i--) {
|
|
145
|
-
if (tagNames.
|
|
139
|
+
if (tagNames.has(this.tagIDs[i]) && this.treeAdapter.getNamespaceURI(this.items[i]) === namespace) {
|
|
146
140
|
return i;
|
|
147
141
|
}
|
|
148
142
|
}
|
|
@@ -192,102 +186,117 @@ export class OpenElementStack {
|
|
|
192
186
|
return this.stackTop === 0 && this.tagIDs[0] === $.HTML;
|
|
193
187
|
}
|
|
194
188
|
//Element in scope
|
|
195
|
-
|
|
189
|
+
hasInDynamicScope(tagName, htmlScope) {
|
|
196
190
|
for (let i = this.stackTop; i >= 0; i--) {
|
|
197
191
|
const tn = this.tagIDs[i];
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
192
|
+
switch (this.treeAdapter.getNamespaceURI(this.items[i])) {
|
|
193
|
+
case NS.HTML: {
|
|
194
|
+
if (tn === tagName)
|
|
195
|
+
return true;
|
|
196
|
+
if (htmlScope.has(tn))
|
|
197
|
+
return false;
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
case NS.SVG: {
|
|
201
|
+
if (SCOPING_ELEMENTS_SVG.has(tn))
|
|
202
|
+
return false;
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
case NS.MATHML: {
|
|
206
|
+
if (SCOPING_ELEMENTS_MATHML.has(tn))
|
|
207
|
+
return false;
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
204
210
|
}
|
|
205
211
|
}
|
|
206
212
|
return true;
|
|
207
213
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
const tn = this.tagIDs[i];
|
|
211
|
-
const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
|
|
212
|
-
if (isNumberedHeader(tn) && ns === NS.HTML) {
|
|
213
|
-
return true;
|
|
214
|
-
}
|
|
215
|
-
if (SCOPING_ELEMENT_NS.get(tn) === ns) {
|
|
216
|
-
return false;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
return true;
|
|
214
|
+
hasInScope(tagName) {
|
|
215
|
+
return this.hasInDynamicScope(tagName, SCOPING_ELEMENTS_HTML);
|
|
220
216
|
}
|
|
221
217
|
hasInListItemScope(tagName) {
|
|
222
|
-
|
|
223
|
-
const tn = this.tagIDs[i];
|
|
224
|
-
const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
|
|
225
|
-
if (tn === tagName && ns === NS.HTML) {
|
|
226
|
-
return true;
|
|
227
|
-
}
|
|
228
|
-
if (((tn === $.UL || tn === $.OL) && ns === NS.HTML) || SCOPING_ELEMENT_NS.get(tn) === ns) {
|
|
229
|
-
return false;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
return true;
|
|
218
|
+
return this.hasInDynamicScope(tagName, SCOPING_ELEMENTS_HTML_LIST);
|
|
233
219
|
}
|
|
234
220
|
hasInButtonScope(tagName) {
|
|
221
|
+
return this.hasInDynamicScope(tagName, SCOPING_ELEMENTS_HTML_BUTTON);
|
|
222
|
+
}
|
|
223
|
+
hasNumberedHeaderInScope() {
|
|
235
224
|
for (let i = this.stackTop; i >= 0; i--) {
|
|
236
225
|
const tn = this.tagIDs[i];
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
226
|
+
switch (this.treeAdapter.getNamespaceURI(this.items[i])) {
|
|
227
|
+
case NS.HTML: {
|
|
228
|
+
if (NUMBERED_HEADERS.has(tn))
|
|
229
|
+
return true;
|
|
230
|
+
if (SCOPING_ELEMENTS_HTML.has(tn))
|
|
231
|
+
return false;
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
case NS.SVG: {
|
|
235
|
+
if (SCOPING_ELEMENTS_SVG.has(tn))
|
|
236
|
+
return false;
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
239
|
+
case NS.MATHML: {
|
|
240
|
+
if (SCOPING_ELEMENTS_MATHML.has(tn))
|
|
241
|
+
return false;
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
243
244
|
}
|
|
244
245
|
}
|
|
245
246
|
return true;
|
|
246
247
|
}
|
|
247
248
|
hasInTableScope(tagName) {
|
|
248
249
|
for (let i = this.stackTop; i >= 0; i--) {
|
|
249
|
-
|
|
250
|
-
const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
|
|
251
|
-
if (ns !== NS.HTML) {
|
|
250
|
+
if (this.treeAdapter.getNamespaceURI(this.items[i]) !== NS.HTML) {
|
|
252
251
|
continue;
|
|
253
252
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
253
|
+
switch (this.tagIDs[i]) {
|
|
254
|
+
case tagName: {
|
|
255
|
+
return true;
|
|
256
|
+
}
|
|
257
|
+
case $.TABLE:
|
|
258
|
+
case $.HTML: {
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
259
261
|
}
|
|
260
262
|
}
|
|
261
263
|
return true;
|
|
262
264
|
}
|
|
263
265
|
hasTableBodyContextInTableScope() {
|
|
264
266
|
for (let i = this.stackTop; i >= 0; i--) {
|
|
265
|
-
|
|
266
|
-
const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
|
|
267
|
-
if (ns !== NS.HTML) {
|
|
267
|
+
if (this.treeAdapter.getNamespaceURI(this.items[i]) !== NS.HTML) {
|
|
268
268
|
continue;
|
|
269
269
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
270
|
+
switch (this.tagIDs[i]) {
|
|
271
|
+
case $.TBODY:
|
|
272
|
+
case $.THEAD:
|
|
273
|
+
case $.TFOOT: {
|
|
274
|
+
return true;
|
|
275
|
+
}
|
|
276
|
+
case $.TABLE:
|
|
277
|
+
case $.HTML: {
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
275
280
|
}
|
|
276
281
|
}
|
|
277
282
|
return true;
|
|
278
283
|
}
|
|
279
284
|
hasInSelectScope(tagName) {
|
|
280
285
|
for (let i = this.stackTop; i >= 0; i--) {
|
|
281
|
-
|
|
282
|
-
const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
|
|
283
|
-
if (ns !== NS.HTML) {
|
|
286
|
+
if (this.treeAdapter.getNamespaceURI(this.items[i]) !== NS.HTML) {
|
|
284
287
|
continue;
|
|
285
288
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
289
|
+
switch (this.tagIDs[i]) {
|
|
290
|
+
case tagName: {
|
|
291
|
+
return true;
|
|
292
|
+
}
|
|
293
|
+
case $.OPTION:
|
|
294
|
+
case $.OPTGROUP: {
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
default: {
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
291
300
|
}
|
|
292
301
|
}
|
|
293
302
|
return true;
|
|
@@ -309,4 +318,3 @@ export class OpenElementStack {
|
|
|
309
318
|
}
|
|
310
319
|
}
|
|
311
320
|
}
|
|
312
|
-
//# sourceMappingURL=open-element-stack.js.map
|