@stencil/core 4.27.2 → 4.28.0
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/cli/index.cjs +1 -1
- package/cli/index.js +1 -1
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/stencil.js +27825 -32582
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +3 -3
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +2 -2
- package/internal/app-data/package.json +1 -1
- package/internal/client/index.js +1 -1
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/hydrate/index.js +1 -1
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.js +290 -396
- package/internal/package.json +1 -1
- package/internal/stencil-public-compiler.d.ts +1 -1
- package/internal/stencil-public-runtime.d.ts +1 -0
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +1439 -1530
- package/mock-doc/index.js +1439 -1530
- package/mock-doc/package.json +1 -1
- package/package.json +12 -8
- package/screenshot/index.js +1 -1
- package/screenshot/package.json +1 -1
- package/screenshot/pixel-match.js +1 -1
- package/sys/node/autoprefixer.js +2 -2
- package/sys/node/index.js +1 -1
- package/sys/node/node-fetch.js +1 -1
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +1 -1
- package/testing/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Stencil Hydrate Runner v4.
|
|
2
|
+
Stencil Hydrate Runner v4.28.0 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
@@ -781,7 +781,6 @@ var CODE_POINTS;
|
|
|
781
781
|
CODE_POINTS2[CODE_POINTS2["SPACE"] = 32] = "SPACE";
|
|
782
782
|
CODE_POINTS2[CODE_POINTS2["EXCLAMATION_MARK"] = 33] = "EXCLAMATION_MARK";
|
|
783
783
|
CODE_POINTS2[CODE_POINTS2["QUOTATION_MARK"] = 34] = "QUOTATION_MARK";
|
|
784
|
-
CODE_POINTS2[CODE_POINTS2["NUMBER_SIGN"] = 35] = "NUMBER_SIGN";
|
|
785
784
|
CODE_POINTS2[CODE_POINTS2["AMPERSAND"] = 38] = "AMPERSAND";
|
|
786
785
|
CODE_POINTS2[CODE_POINTS2["APOSTROPHE"] = 39] = "APOSTROPHE";
|
|
787
786
|
CODE_POINTS2[CODE_POINTS2["HYPHEN_MINUS"] = 45] = "HYPHEN_MINUS";
|
|
@@ -794,17 +793,12 @@ var CODE_POINTS;
|
|
|
794
793
|
CODE_POINTS2[CODE_POINTS2["GREATER_THAN_SIGN"] = 62] = "GREATER_THAN_SIGN";
|
|
795
794
|
CODE_POINTS2[CODE_POINTS2["QUESTION_MARK"] = 63] = "QUESTION_MARK";
|
|
796
795
|
CODE_POINTS2[CODE_POINTS2["LATIN_CAPITAL_A"] = 65] = "LATIN_CAPITAL_A";
|
|
797
|
-
CODE_POINTS2[CODE_POINTS2["LATIN_CAPITAL_F"] = 70] = "LATIN_CAPITAL_F";
|
|
798
|
-
CODE_POINTS2[CODE_POINTS2["LATIN_CAPITAL_X"] = 88] = "LATIN_CAPITAL_X";
|
|
799
796
|
CODE_POINTS2[CODE_POINTS2["LATIN_CAPITAL_Z"] = 90] = "LATIN_CAPITAL_Z";
|
|
800
797
|
CODE_POINTS2[CODE_POINTS2["RIGHT_SQUARE_BRACKET"] = 93] = "RIGHT_SQUARE_BRACKET";
|
|
801
798
|
CODE_POINTS2[CODE_POINTS2["GRAVE_ACCENT"] = 96] = "GRAVE_ACCENT";
|
|
802
799
|
CODE_POINTS2[CODE_POINTS2["LATIN_SMALL_A"] = 97] = "LATIN_SMALL_A";
|
|
803
|
-
CODE_POINTS2[CODE_POINTS2["LATIN_SMALL_F"] = 102] = "LATIN_SMALL_F";
|
|
804
|
-
CODE_POINTS2[CODE_POINTS2["LATIN_SMALL_X"] = 120] = "LATIN_SMALL_X";
|
|
805
800
|
CODE_POINTS2[CODE_POINTS2["LATIN_SMALL_Z"] = 122] = "LATIN_SMALL_Z";
|
|
806
|
-
|
|
807
|
-
})(CODE_POINTS = CODE_POINTS || (CODE_POINTS = {}));
|
|
801
|
+
})(CODE_POINTS || (CODE_POINTS = {}));
|
|
808
802
|
var SEQUENCES = {
|
|
809
803
|
DASH_DASH: "--",
|
|
810
804
|
CDATA_START: "[CDATA[",
|
|
@@ -892,7 +886,7 @@ var ERR;
|
|
|
892
886
|
ERR2["misplacedStartTagForHeadElement"] = "misplaced-start-tag-for-head-element";
|
|
893
887
|
ERR2["nestedNoscriptInHead"] = "nested-noscript-in-head";
|
|
894
888
|
ERR2["eofInElementThatCanContainOnlyText"] = "eof-in-element-that-can-contain-only-text";
|
|
895
|
-
})(ERR
|
|
889
|
+
})(ERR || (ERR = {}));
|
|
896
890
|
|
|
897
891
|
// node_modules/parse5/dist/tokenizer/preprocessor.js
|
|
898
892
|
var DEFAULT_BUFFER_WATERLINE = 1 << 16;
|
|
@@ -920,22 +914,24 @@ var Preprocessor = class {
|
|
|
920
914
|
get offset() {
|
|
921
915
|
return this.droppedBufferSize + this.pos;
|
|
922
916
|
}
|
|
923
|
-
getError(code) {
|
|
917
|
+
getError(code, cpOffset) {
|
|
924
918
|
const { line, col, offset } = this;
|
|
919
|
+
const startCol = col + cpOffset;
|
|
920
|
+
const startOffset = offset + cpOffset;
|
|
925
921
|
return {
|
|
926
922
|
code,
|
|
927
923
|
startLine: line,
|
|
928
924
|
endLine: line,
|
|
929
|
-
startCol
|
|
930
|
-
endCol:
|
|
931
|
-
startOffset
|
|
932
|
-
endOffset:
|
|
925
|
+
startCol,
|
|
926
|
+
endCol: startCol,
|
|
927
|
+
startOffset,
|
|
928
|
+
endOffset: startOffset
|
|
933
929
|
};
|
|
934
930
|
}
|
|
935
931
|
_err(code) {
|
|
936
932
|
if (this.handler.onParseError && this.lastErrOffset !== this.offset) {
|
|
937
933
|
this.lastErrOffset = this.offset;
|
|
938
|
-
this.handler.onParseError(this.getError(code));
|
|
934
|
+
this.handler.onParseError(this.getError(code, 0));
|
|
939
935
|
}
|
|
940
936
|
}
|
|
941
937
|
_addGap() {
|
|
@@ -1078,7 +1074,7 @@ var TokenType;
|
|
|
1078
1074
|
TokenType2[TokenType2["DOCTYPE"] = 6] = "DOCTYPE";
|
|
1079
1075
|
TokenType2[TokenType2["EOF"] = 7] = "EOF";
|
|
1080
1076
|
TokenType2[TokenType2["HIBERNATION"] = 8] = "HIBERNATION";
|
|
1081
|
-
})(TokenType
|
|
1077
|
+
})(TokenType || (TokenType = {}));
|
|
1082
1078
|
function getTokenAttr(token, attrName) {
|
|
1083
1079
|
for (let i = token.attrs.length - 1; i >= 0; i--) {
|
|
1084
1080
|
if (token.attrs[i].name === attrName) {
|
|
@@ -1524,12 +1520,12 @@ __export(html_exports, {
|
|
|
1524
1520
|
ATTRS: () => ATTRS,
|
|
1525
1521
|
DOCUMENT_MODE: () => DOCUMENT_MODE,
|
|
1526
1522
|
NS: () => NS,
|
|
1523
|
+
NUMBERED_HEADERS: () => NUMBERED_HEADERS,
|
|
1527
1524
|
SPECIAL_ELEMENTS: () => SPECIAL_ELEMENTS,
|
|
1528
1525
|
TAG_ID: () => TAG_ID,
|
|
1529
1526
|
TAG_NAMES: () => TAG_NAMES,
|
|
1530
1527
|
getTagID: () => getTagID,
|
|
1531
|
-
hasUnescapedText: () => hasUnescapedText
|
|
1532
|
-
isNumberedHeader: () => isNumberedHeader
|
|
1528
|
+
hasUnescapedText: () => hasUnescapedText
|
|
1533
1529
|
});
|
|
1534
1530
|
var NS;
|
|
1535
1531
|
(function(NS2) {
|
|
@@ -1539,7 +1535,7 @@ var NS;
|
|
|
1539
1535
|
NS2["XLINK"] = "http://www.w3.org/1999/xlink";
|
|
1540
1536
|
NS2["XML"] = "http://www.w3.org/XML/1998/namespace";
|
|
1541
1537
|
NS2["XMLNS"] = "http://www.w3.org/2000/xmlns/";
|
|
1542
|
-
})(NS
|
|
1538
|
+
})(NS || (NS = {}));
|
|
1543
1539
|
var ATTRS;
|
|
1544
1540
|
(function(ATTRS2) {
|
|
1545
1541
|
ATTRS2["TYPE"] = "type";
|
|
@@ -1550,13 +1546,13 @@ var ATTRS;
|
|
|
1550
1546
|
ATTRS2["COLOR"] = "color";
|
|
1551
1547
|
ATTRS2["FACE"] = "face";
|
|
1552
1548
|
ATTRS2["SIZE"] = "size";
|
|
1553
|
-
})(ATTRS
|
|
1549
|
+
})(ATTRS || (ATTRS = {}));
|
|
1554
1550
|
var DOCUMENT_MODE;
|
|
1555
1551
|
(function(DOCUMENT_MODE2) {
|
|
1556
1552
|
DOCUMENT_MODE2["NO_QUIRKS"] = "no-quirks";
|
|
1557
1553
|
DOCUMENT_MODE2["QUIRKS"] = "quirks";
|
|
1558
1554
|
DOCUMENT_MODE2["LIMITED_QUIRKS"] = "limited-quirks";
|
|
1559
|
-
})(DOCUMENT_MODE
|
|
1555
|
+
})(DOCUMENT_MODE || (DOCUMENT_MODE = {}));
|
|
1560
1556
|
var TAG_NAMES;
|
|
1561
1557
|
(function(TAG_NAMES2) {
|
|
1562
1558
|
TAG_NAMES2["A"] = "a";
|
|
@@ -1652,6 +1648,7 @@ var TAG_NAMES;
|
|
|
1652
1648
|
TAG_NAMES2["RUBY"] = "ruby";
|
|
1653
1649
|
TAG_NAMES2["S"] = "s";
|
|
1654
1650
|
TAG_NAMES2["SCRIPT"] = "script";
|
|
1651
|
+
TAG_NAMES2["SEARCH"] = "search";
|
|
1655
1652
|
TAG_NAMES2["SECTION"] = "section";
|
|
1656
1653
|
TAG_NAMES2["SELECT"] = "select";
|
|
1657
1654
|
TAG_NAMES2["SOURCE"] = "source";
|
|
@@ -1681,7 +1678,7 @@ var TAG_NAMES;
|
|
|
1681
1678
|
TAG_NAMES2["VAR"] = "var";
|
|
1682
1679
|
TAG_NAMES2["WBR"] = "wbr";
|
|
1683
1680
|
TAG_NAMES2["XMP"] = "xmp";
|
|
1684
|
-
})(TAG_NAMES
|
|
1681
|
+
})(TAG_NAMES || (TAG_NAMES = {}));
|
|
1685
1682
|
var TAG_ID;
|
|
1686
1683
|
(function(TAG_ID2) {
|
|
1687
1684
|
TAG_ID2[TAG_ID2["UNKNOWN"] = 0] = "UNKNOWN";
|
|
@@ -1778,36 +1775,37 @@ var TAG_ID;
|
|
|
1778
1775
|
TAG_ID2[TAG_ID2["RUBY"] = 91] = "RUBY";
|
|
1779
1776
|
TAG_ID2[TAG_ID2["S"] = 92] = "S";
|
|
1780
1777
|
TAG_ID2[TAG_ID2["SCRIPT"] = 93] = "SCRIPT";
|
|
1781
|
-
TAG_ID2[TAG_ID2["
|
|
1782
|
-
TAG_ID2[TAG_ID2["
|
|
1783
|
-
TAG_ID2[TAG_ID2["
|
|
1784
|
-
TAG_ID2[TAG_ID2["
|
|
1785
|
-
TAG_ID2[TAG_ID2["
|
|
1786
|
-
TAG_ID2[TAG_ID2["
|
|
1787
|
-
TAG_ID2[TAG_ID2["
|
|
1788
|
-
TAG_ID2[TAG_ID2["
|
|
1789
|
-
TAG_ID2[TAG_ID2["
|
|
1790
|
-
TAG_ID2[TAG_ID2["
|
|
1791
|
-
TAG_ID2[TAG_ID2["
|
|
1792
|
-
TAG_ID2[TAG_ID2["
|
|
1793
|
-
TAG_ID2[TAG_ID2["
|
|
1794
|
-
TAG_ID2[TAG_ID2["
|
|
1795
|
-
TAG_ID2[TAG_ID2["
|
|
1796
|
-
TAG_ID2[TAG_ID2["
|
|
1797
|
-
TAG_ID2[TAG_ID2["
|
|
1798
|
-
TAG_ID2[TAG_ID2["
|
|
1799
|
-
TAG_ID2[TAG_ID2["
|
|
1800
|
-
TAG_ID2[TAG_ID2["
|
|
1801
|
-
TAG_ID2[TAG_ID2["
|
|
1802
|
-
TAG_ID2[TAG_ID2["
|
|
1803
|
-
TAG_ID2[TAG_ID2["
|
|
1804
|
-
TAG_ID2[TAG_ID2["
|
|
1805
|
-
TAG_ID2[TAG_ID2["
|
|
1806
|
-
TAG_ID2[TAG_ID2["
|
|
1807
|
-
TAG_ID2[TAG_ID2["
|
|
1808
|
-
TAG_ID2[TAG_ID2["
|
|
1809
|
-
TAG_ID2[TAG_ID2["
|
|
1810
|
-
|
|
1778
|
+
TAG_ID2[TAG_ID2["SEARCH"] = 94] = "SEARCH";
|
|
1779
|
+
TAG_ID2[TAG_ID2["SECTION"] = 95] = "SECTION";
|
|
1780
|
+
TAG_ID2[TAG_ID2["SELECT"] = 96] = "SELECT";
|
|
1781
|
+
TAG_ID2[TAG_ID2["SOURCE"] = 97] = "SOURCE";
|
|
1782
|
+
TAG_ID2[TAG_ID2["SMALL"] = 98] = "SMALL";
|
|
1783
|
+
TAG_ID2[TAG_ID2["SPAN"] = 99] = "SPAN";
|
|
1784
|
+
TAG_ID2[TAG_ID2["STRIKE"] = 100] = "STRIKE";
|
|
1785
|
+
TAG_ID2[TAG_ID2["STRONG"] = 101] = "STRONG";
|
|
1786
|
+
TAG_ID2[TAG_ID2["STYLE"] = 102] = "STYLE";
|
|
1787
|
+
TAG_ID2[TAG_ID2["SUB"] = 103] = "SUB";
|
|
1788
|
+
TAG_ID2[TAG_ID2["SUMMARY"] = 104] = "SUMMARY";
|
|
1789
|
+
TAG_ID2[TAG_ID2["SUP"] = 105] = "SUP";
|
|
1790
|
+
TAG_ID2[TAG_ID2["TABLE"] = 106] = "TABLE";
|
|
1791
|
+
TAG_ID2[TAG_ID2["TBODY"] = 107] = "TBODY";
|
|
1792
|
+
TAG_ID2[TAG_ID2["TEMPLATE"] = 108] = "TEMPLATE";
|
|
1793
|
+
TAG_ID2[TAG_ID2["TEXTAREA"] = 109] = "TEXTAREA";
|
|
1794
|
+
TAG_ID2[TAG_ID2["TFOOT"] = 110] = "TFOOT";
|
|
1795
|
+
TAG_ID2[TAG_ID2["TD"] = 111] = "TD";
|
|
1796
|
+
TAG_ID2[TAG_ID2["TH"] = 112] = "TH";
|
|
1797
|
+
TAG_ID2[TAG_ID2["THEAD"] = 113] = "THEAD";
|
|
1798
|
+
TAG_ID2[TAG_ID2["TITLE"] = 114] = "TITLE";
|
|
1799
|
+
TAG_ID2[TAG_ID2["TR"] = 115] = "TR";
|
|
1800
|
+
TAG_ID2[TAG_ID2["TRACK"] = 116] = "TRACK";
|
|
1801
|
+
TAG_ID2[TAG_ID2["TT"] = 117] = "TT";
|
|
1802
|
+
TAG_ID2[TAG_ID2["U"] = 118] = "U";
|
|
1803
|
+
TAG_ID2[TAG_ID2["UL"] = 119] = "UL";
|
|
1804
|
+
TAG_ID2[TAG_ID2["SVG"] = 120] = "SVG";
|
|
1805
|
+
TAG_ID2[TAG_ID2["VAR"] = 121] = "VAR";
|
|
1806
|
+
TAG_ID2[TAG_ID2["WBR"] = 122] = "WBR";
|
|
1807
|
+
TAG_ID2[TAG_ID2["XMP"] = 123] = "XMP";
|
|
1808
|
+
})(TAG_ID || (TAG_ID = {}));
|
|
1811
1809
|
var TAG_NAME_TO_ID = /* @__PURE__ */ new Map([
|
|
1812
1810
|
[TAG_NAMES.A, TAG_ID.A],
|
|
1813
1811
|
[TAG_NAMES.ADDRESS, TAG_ID.ADDRESS],
|
|
@@ -1902,6 +1900,7 @@ var TAG_NAME_TO_ID = /* @__PURE__ */ new Map([
|
|
|
1902
1900
|
[TAG_NAMES.RUBY, TAG_ID.RUBY],
|
|
1903
1901
|
[TAG_NAMES.S, TAG_ID.S],
|
|
1904
1902
|
[TAG_NAMES.SCRIPT, TAG_ID.SCRIPT],
|
|
1903
|
+
[TAG_NAMES.SEARCH, TAG_ID.SEARCH],
|
|
1905
1904
|
[TAG_NAMES.SECTION, TAG_ID.SECTION],
|
|
1906
1905
|
[TAG_NAMES.SELECT, TAG_ID.SELECT],
|
|
1907
1906
|
[TAG_NAMES.SOURCE, TAG_ID.SOURCE],
|
|
@@ -2027,9 +2026,7 @@ var SPECIAL_ELEMENTS = {
|
|
|
2027
2026
|
[NS.XML]: /* @__PURE__ */ new Set(),
|
|
2028
2027
|
[NS.XMLNS]: /* @__PURE__ */ new Set()
|
|
2029
2028
|
};
|
|
2030
|
-
|
|
2031
|
-
return tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6;
|
|
2032
|
-
}
|
|
2029
|
+
var NUMBERED_HEADERS = /* @__PURE__ */ new Set([$.H1, $.H2, $.H3, $.H4, $.H5, $.H6]);
|
|
2033
2030
|
var UNESCAPED_TEXT = /* @__PURE__ */ new Set([
|
|
2034
2031
|
TAG_NAMES.STYLE,
|
|
2035
2032
|
TAG_NAMES.SCRIPT,
|
|
@@ -2044,35 +2041,6 @@ function hasUnescapedText(tn, scriptingEnabled) {
|
|
|
2044
2041
|
}
|
|
2045
2042
|
|
|
2046
2043
|
// node_modules/parse5/dist/tokenizer/index.js
|
|
2047
|
-
var C1_CONTROLS_REFERENCE_REPLACEMENTS = /* @__PURE__ */ new Map([
|
|
2048
|
-
[128, 8364],
|
|
2049
|
-
[130, 8218],
|
|
2050
|
-
[131, 402],
|
|
2051
|
-
[132, 8222],
|
|
2052
|
-
[133, 8230],
|
|
2053
|
-
[134, 8224],
|
|
2054
|
-
[135, 8225],
|
|
2055
|
-
[136, 710],
|
|
2056
|
-
[137, 8240],
|
|
2057
|
-
[138, 352],
|
|
2058
|
-
[139, 8249],
|
|
2059
|
-
[140, 338],
|
|
2060
|
-
[142, 381],
|
|
2061
|
-
[145, 8216],
|
|
2062
|
-
[146, 8217],
|
|
2063
|
-
[147, 8220],
|
|
2064
|
-
[148, 8221],
|
|
2065
|
-
[149, 8226],
|
|
2066
|
-
[150, 8211],
|
|
2067
|
-
[151, 8212],
|
|
2068
|
-
[152, 732],
|
|
2069
|
-
[153, 8482],
|
|
2070
|
-
[154, 353],
|
|
2071
|
-
[155, 8250],
|
|
2072
|
-
[156, 339],
|
|
2073
|
-
[158, 382],
|
|
2074
|
-
[159, 376]
|
|
2075
|
-
]);
|
|
2076
2044
|
var State;
|
|
2077
2045
|
(function(State2) {
|
|
2078
2046
|
State2[State2["DATA"] = 0] = "DATA";
|
|
@@ -2147,13 +2115,7 @@ var State;
|
|
|
2147
2115
|
State2[State2["CDATA_SECTION_BRACKET"] = 69] = "CDATA_SECTION_BRACKET";
|
|
2148
2116
|
State2[State2["CDATA_SECTION_END"] = 70] = "CDATA_SECTION_END";
|
|
2149
2117
|
State2[State2["CHARACTER_REFERENCE"] = 71] = "CHARACTER_REFERENCE";
|
|
2150
|
-
State2[State2["
|
|
2151
|
-
State2[State2["AMBIGUOUS_AMPERSAND"] = 73] = "AMBIGUOUS_AMPERSAND";
|
|
2152
|
-
State2[State2["NUMERIC_CHARACTER_REFERENCE"] = 74] = "NUMERIC_CHARACTER_REFERENCE";
|
|
2153
|
-
State2[State2["HEXADEMICAL_CHARACTER_REFERENCE_START"] = 75] = "HEXADEMICAL_CHARACTER_REFERENCE_START";
|
|
2154
|
-
State2[State2["HEXADEMICAL_CHARACTER_REFERENCE"] = 76] = "HEXADEMICAL_CHARACTER_REFERENCE";
|
|
2155
|
-
State2[State2["DECIMAL_CHARACTER_REFERENCE"] = 77] = "DECIMAL_CHARACTER_REFERENCE";
|
|
2156
|
-
State2[State2["NUMERIC_CHARACTER_REFERENCE_END"] = 78] = "NUMERIC_CHARACTER_REFERENCE_END";
|
|
2118
|
+
State2[State2["AMBIGUOUS_AMPERSAND"] = 72] = "AMBIGUOUS_AMPERSAND";
|
|
2157
2119
|
})(State || (State = {}));
|
|
2158
2120
|
var TokenizerMode = {
|
|
2159
2121
|
DATA: State.DATA,
|
|
@@ -2178,27 +2140,29 @@ function isAsciiLetter(cp) {
|
|
|
2178
2140
|
function isAsciiAlphaNumeric2(cp) {
|
|
2179
2141
|
return isAsciiLetter(cp) || isAsciiDigit(cp);
|
|
2180
2142
|
}
|
|
2181
|
-
function isAsciiUpperHexDigit(cp) {
|
|
2182
|
-
return cp >= CODE_POINTS.LATIN_CAPITAL_A && cp <= CODE_POINTS.LATIN_CAPITAL_F;
|
|
2183
|
-
}
|
|
2184
|
-
function isAsciiLowerHexDigit(cp) {
|
|
2185
|
-
return cp >= CODE_POINTS.LATIN_SMALL_A && cp <= CODE_POINTS.LATIN_SMALL_F;
|
|
2186
|
-
}
|
|
2187
|
-
function isAsciiHexDigit(cp) {
|
|
2188
|
-
return isAsciiDigit(cp) || isAsciiUpperHexDigit(cp) || isAsciiLowerHexDigit(cp);
|
|
2189
|
-
}
|
|
2190
2143
|
function toAsciiLower(cp) {
|
|
2191
2144
|
return cp + 32;
|
|
2192
2145
|
}
|
|
2193
2146
|
function isWhitespace(cp) {
|
|
2194
2147
|
return cp === CODE_POINTS.SPACE || cp === CODE_POINTS.LINE_FEED || cp === CODE_POINTS.TABULATION || cp === CODE_POINTS.FORM_FEED;
|
|
2195
2148
|
}
|
|
2196
|
-
function isEntityInAttributeInvalidEnd2(nextCp) {
|
|
2197
|
-
return nextCp === CODE_POINTS.EQUALS_SIGN || isAsciiAlphaNumeric2(nextCp);
|
|
2198
|
-
}
|
|
2199
2149
|
function isScriptDataDoubleEscapeSequenceEnd(cp) {
|
|
2200
2150
|
return isWhitespace(cp) || cp === CODE_POINTS.SOLIDUS || cp === CODE_POINTS.GREATER_THAN_SIGN;
|
|
2201
2151
|
}
|
|
2152
|
+
function getErrorForNumericCharacterReference(code) {
|
|
2153
|
+
if (code === CODE_POINTS.NULL) {
|
|
2154
|
+
return ERR.nullCharacterReference;
|
|
2155
|
+
} else if (code > 1114111) {
|
|
2156
|
+
return ERR.characterReferenceOutsideUnicodeRange;
|
|
2157
|
+
} else if (isSurrogate(code)) {
|
|
2158
|
+
return ERR.surrogateCharacterReference;
|
|
2159
|
+
} else if (isUndefinedCodePoint(code)) {
|
|
2160
|
+
return ERR.noncharacterCharacterReference;
|
|
2161
|
+
} else if (isControlCodePoint(code) || code === CODE_POINTS.CARRIAGE_RETURN) {
|
|
2162
|
+
return ERR.controlCharacterReference;
|
|
2163
|
+
}
|
|
2164
|
+
return null;
|
|
2165
|
+
}
|
|
2202
2166
|
var Tokenizer = class {
|
|
2203
2167
|
constructor(options, handler) {
|
|
2204
2168
|
this.options = options;
|
|
@@ -2210,18 +2174,34 @@ var Tokenizer = class {
|
|
|
2210
2174
|
this.active = false;
|
|
2211
2175
|
this.state = State.DATA;
|
|
2212
2176
|
this.returnState = State.DATA;
|
|
2213
|
-
this.
|
|
2177
|
+
this.entityStartPos = 0;
|
|
2214
2178
|
this.consumedAfterSnapshot = -1;
|
|
2215
2179
|
this.currentCharacterToken = null;
|
|
2216
2180
|
this.currentToken = null;
|
|
2217
2181
|
this.currentAttr = { name: "", value: "" };
|
|
2218
2182
|
this.preprocessor = new Preprocessor(handler);
|
|
2219
2183
|
this.currentLocation = this.getCurrentLocation(-1);
|
|
2184
|
+
this.entityDecoder = new EntityDecoder(decode_data_html_default, (cp, consumed) => {
|
|
2185
|
+
this.preprocessor.pos = this.entityStartPos + consumed - 1;
|
|
2186
|
+
this._flushCodePointConsumedAsCharacterReference(cp);
|
|
2187
|
+
}, handler.onParseError ? {
|
|
2188
|
+
missingSemicolonAfterCharacterReference: () => {
|
|
2189
|
+
this._err(ERR.missingSemicolonAfterCharacterReference, 1);
|
|
2190
|
+
},
|
|
2191
|
+
absenceOfDigitsInNumericCharacterReference: (consumed) => {
|
|
2192
|
+
this._err(ERR.absenceOfDigitsInNumericCharacterReference, this.entityStartPos - this.preprocessor.pos + consumed);
|
|
2193
|
+
},
|
|
2194
|
+
validateNumericCharacterReference: (code) => {
|
|
2195
|
+
const error = getErrorForNumericCharacterReference(code);
|
|
2196
|
+
if (error)
|
|
2197
|
+
this._err(error, 1);
|
|
2198
|
+
}
|
|
2199
|
+
} : void 0);
|
|
2220
2200
|
}
|
|
2221
2201
|
//Errors
|
|
2222
|
-
_err(code) {
|
|
2202
|
+
_err(code, cpOffset = 0) {
|
|
2223
2203
|
var _a2, _b;
|
|
2224
|
-
(_b = (_a2 = this.handler).onParseError) === null || _b === void 0 ? void 0 : _b.call(_a2, this.preprocessor.getError(code));
|
|
2204
|
+
(_b = (_a2 = this.handler).onParseError) === null || _b === void 0 ? void 0 : _b.call(_a2, this.preprocessor.getError(code, cpOffset));
|
|
2225
2205
|
}
|
|
2226
2206
|
// NOTE: `offset` may never run across line boundaries.
|
|
2227
2207
|
getCurrentLocation(offset) {
|
|
@@ -2282,7 +2262,8 @@ var Tokenizer = class {
|
|
|
2282
2262
|
//Hibernation
|
|
2283
2263
|
_ensureHibernation() {
|
|
2284
2264
|
if (this.preprocessor.endOfChunkHit) {
|
|
2285
|
-
this.
|
|
2265
|
+
this.preprocessor.retreat(this.consumedAfterSnapshot);
|
|
2266
|
+
this.consumedAfterSnapshot = 0;
|
|
2286
2267
|
this.active = false;
|
|
2287
2268
|
return true;
|
|
2288
2269
|
}
|
|
@@ -2293,14 +2274,6 @@ var Tokenizer = class {
|
|
|
2293
2274
|
this.consumedAfterSnapshot++;
|
|
2294
2275
|
return this.preprocessor.advance();
|
|
2295
2276
|
}
|
|
2296
|
-
_unconsume(count) {
|
|
2297
|
-
this.consumedAfterSnapshot -= count;
|
|
2298
|
-
this.preprocessor.retreat(count);
|
|
2299
|
-
}
|
|
2300
|
-
_reconsumeInState(state, cp) {
|
|
2301
|
-
this.state = state;
|
|
2302
|
-
this._callState(cp);
|
|
2303
|
-
}
|
|
2304
2277
|
_advanceBy(count) {
|
|
2305
2278
|
this.consumedAfterSnapshot += count;
|
|
2306
2279
|
for (let i = 0; i < count; i++) {
|
|
@@ -2466,7 +2439,7 @@ var Tokenizer = class {
|
|
|
2466
2439
|
this.active = false;
|
|
2467
2440
|
}
|
|
2468
2441
|
//Characters emission
|
|
2469
|
-
//OPTIMIZATION: specification uses only one type of character
|
|
2442
|
+
//OPTIMIZATION: The specification uses only one type of character token (one token per character).
|
|
2470
2443
|
//This causes a huge memory overhead and a lot of unnecessary parser loops. parse5 uses 3 groups of characters.
|
|
2471
2444
|
//If we have a sequence of characters that belong to the same group, the parser can process it
|
|
2472
2445
|
//as a single solid character token.
|
|
@@ -2476,13 +2449,13 @@ var Tokenizer = class {
|
|
|
2476
2449
|
//3)TokenType.CHARACTER - any character sequence which don't belong to groups 1 and 2 (e.g. 'abcdef1234@@#$%^')
|
|
2477
2450
|
_appendCharToCurrentCharacterToken(type, ch) {
|
|
2478
2451
|
if (this.currentCharacterToken) {
|
|
2479
|
-
if (this.currentCharacterToken.type
|
|
2452
|
+
if (this.currentCharacterToken.type === type) {
|
|
2453
|
+
this.currentCharacterToken.chars += ch;
|
|
2454
|
+
return;
|
|
2455
|
+
} else {
|
|
2480
2456
|
this.currentLocation = this.getCurrentLocation(0);
|
|
2481
2457
|
this._emitCurrentCharacterToken(this.currentLocation);
|
|
2482
2458
|
this.preprocessor.dropParsedChunk();
|
|
2483
|
-
} else {
|
|
2484
|
-
this.currentCharacterToken.chars += ch;
|
|
2485
|
-
return;
|
|
2486
2459
|
}
|
|
2487
2460
|
}
|
|
2488
2461
|
this._createCharacterToken(type, ch);
|
|
@@ -2497,39 +2470,11 @@ var Tokenizer = class {
|
|
|
2497
2470
|
this._appendCharToCurrentCharacterToken(TokenType.CHARACTER, ch);
|
|
2498
2471
|
}
|
|
2499
2472
|
// Character reference helpers
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
i = determineBranch(decode_data_html_default, current, i + 1, cp);
|
|
2506
|
-
if (i < 0)
|
|
2507
|
-
break;
|
|
2508
|
-
excess += 1;
|
|
2509
|
-
current = decode_data_html_default[i];
|
|
2510
|
-
const masked = current & BinTrieFlags.VALUE_LENGTH;
|
|
2511
|
-
if (masked) {
|
|
2512
|
-
const valueLength = (masked >> 14) - 1;
|
|
2513
|
-
if (cp !== CODE_POINTS.SEMICOLON && this._isCharacterReferenceInAttribute() && isEntityInAttributeInvalidEnd2(this.preprocessor.peek(1))) {
|
|
2514
|
-
result = [CODE_POINTS.AMPERSAND];
|
|
2515
|
-
i += valueLength;
|
|
2516
|
-
} else {
|
|
2517
|
-
result = valueLength === 0 ? [decode_data_html_default[i] & ~BinTrieFlags.VALUE_LENGTH] : valueLength === 1 ? [decode_data_html_default[++i]] : [decode_data_html_default[++i], decode_data_html_default[++i]];
|
|
2518
|
-
excess = 0;
|
|
2519
|
-
withoutSemicolon = cp !== CODE_POINTS.SEMICOLON;
|
|
2520
|
-
}
|
|
2521
|
-
if (valueLength === 0) {
|
|
2522
|
-
this._consume();
|
|
2523
|
-
break;
|
|
2524
|
-
}
|
|
2525
|
-
}
|
|
2526
|
-
}
|
|
2527
|
-
this._unconsume(excess);
|
|
2528
|
-
if (withoutSemicolon && !this.preprocessor.endOfChunkHit) {
|
|
2529
|
-
this._err(ERR.missingSemicolonAfterCharacterReference);
|
|
2530
|
-
}
|
|
2531
|
-
this._unconsume(1);
|
|
2532
|
-
return result;
|
|
2473
|
+
_startCharacterReference() {
|
|
2474
|
+
this.returnState = this.state;
|
|
2475
|
+
this.state = State.CHARACTER_REFERENCE;
|
|
2476
|
+
this.entityStartPos = this.preprocessor.pos;
|
|
2477
|
+
this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute() ? DecodingMode.Attribute : DecodingMode.Legacy);
|
|
2533
2478
|
}
|
|
2534
2479
|
_isCharacterReferenceInAttribute() {
|
|
2535
2480
|
return this.returnState === State.ATTRIBUTE_VALUE_DOUBLE_QUOTED || this.returnState === State.ATTRIBUTE_VALUE_SINGLE_QUOTED || this.returnState === State.ATTRIBUTE_VALUE_UNQUOTED;
|
|
@@ -2829,37 +2774,13 @@ var Tokenizer = class {
|
|
|
2829
2774
|
break;
|
|
2830
2775
|
}
|
|
2831
2776
|
case State.CHARACTER_REFERENCE: {
|
|
2832
|
-
this._stateCharacterReference(
|
|
2833
|
-
break;
|
|
2834
|
-
}
|
|
2835
|
-
case State.NAMED_CHARACTER_REFERENCE: {
|
|
2836
|
-
this._stateNamedCharacterReference(cp);
|
|
2777
|
+
this._stateCharacterReference();
|
|
2837
2778
|
break;
|
|
2838
2779
|
}
|
|
2839
2780
|
case State.AMBIGUOUS_AMPERSAND: {
|
|
2840
2781
|
this._stateAmbiguousAmpersand(cp);
|
|
2841
2782
|
break;
|
|
2842
2783
|
}
|
|
2843
|
-
case State.NUMERIC_CHARACTER_REFERENCE: {
|
|
2844
|
-
this._stateNumericCharacterReference(cp);
|
|
2845
|
-
break;
|
|
2846
|
-
}
|
|
2847
|
-
case State.HEXADEMICAL_CHARACTER_REFERENCE_START: {
|
|
2848
|
-
this._stateHexademicalCharacterReferenceStart(cp);
|
|
2849
|
-
break;
|
|
2850
|
-
}
|
|
2851
|
-
case State.HEXADEMICAL_CHARACTER_REFERENCE: {
|
|
2852
|
-
this._stateHexademicalCharacterReference(cp);
|
|
2853
|
-
break;
|
|
2854
|
-
}
|
|
2855
|
-
case State.DECIMAL_CHARACTER_REFERENCE: {
|
|
2856
|
-
this._stateDecimalCharacterReference(cp);
|
|
2857
|
-
break;
|
|
2858
|
-
}
|
|
2859
|
-
case State.NUMERIC_CHARACTER_REFERENCE_END: {
|
|
2860
|
-
this._stateNumericCharacterReferenceEnd(cp);
|
|
2861
|
-
break;
|
|
2862
|
-
}
|
|
2863
2784
|
default: {
|
|
2864
2785
|
throw new Error("Unknown state");
|
|
2865
2786
|
}
|
|
@@ -2875,8 +2796,7 @@ var Tokenizer = class {
|
|
|
2875
2796
|
break;
|
|
2876
2797
|
}
|
|
2877
2798
|
case CODE_POINTS.AMPERSAND: {
|
|
2878
|
-
this.
|
|
2879
|
-
this.state = State.CHARACTER_REFERENCE;
|
|
2799
|
+
this._startCharacterReference();
|
|
2880
2800
|
break;
|
|
2881
2801
|
}
|
|
2882
2802
|
case CODE_POINTS.NULL: {
|
|
@@ -2898,8 +2818,7 @@ var Tokenizer = class {
|
|
|
2898
2818
|
_stateRcdata(cp) {
|
|
2899
2819
|
switch (cp) {
|
|
2900
2820
|
case CODE_POINTS.AMPERSAND: {
|
|
2901
|
-
this.
|
|
2902
|
-
this.state = State.CHARACTER_REFERENCE;
|
|
2821
|
+
this._startCharacterReference();
|
|
2903
2822
|
break;
|
|
2904
2823
|
}
|
|
2905
2824
|
case CODE_POINTS.LESS_THAN_SIGN: {
|
|
@@ -3648,8 +3567,7 @@ var Tokenizer = class {
|
|
|
3648
3567
|
break;
|
|
3649
3568
|
}
|
|
3650
3569
|
case CODE_POINTS.AMPERSAND: {
|
|
3651
|
-
this.
|
|
3652
|
-
this.state = State.CHARACTER_REFERENCE;
|
|
3570
|
+
this._startCharacterReference();
|
|
3653
3571
|
break;
|
|
3654
3572
|
}
|
|
3655
3573
|
case CODE_POINTS.NULL: {
|
|
@@ -3676,8 +3594,7 @@ var Tokenizer = class {
|
|
|
3676
3594
|
break;
|
|
3677
3595
|
}
|
|
3678
3596
|
case CODE_POINTS.AMPERSAND: {
|
|
3679
|
-
this.
|
|
3680
|
-
this.state = State.CHARACTER_REFERENCE;
|
|
3597
|
+
this._startCharacterReference();
|
|
3681
3598
|
break;
|
|
3682
3599
|
}
|
|
3683
3600
|
case CODE_POINTS.NULL: {
|
|
@@ -3708,8 +3625,7 @@ var Tokenizer = class {
|
|
|
3708
3625
|
break;
|
|
3709
3626
|
}
|
|
3710
3627
|
case CODE_POINTS.AMPERSAND: {
|
|
3711
|
-
this.
|
|
3712
|
-
this.state = State.CHARACTER_REFERENCE;
|
|
3628
|
+
this._startCharacterReference();
|
|
3713
3629
|
break;
|
|
3714
3630
|
}
|
|
3715
3631
|
case CODE_POINTS.GREATER_THAN_SIGN: {
|
|
@@ -4704,30 +4620,25 @@ var Tokenizer = class {
|
|
|
4704
4620
|
}
|
|
4705
4621
|
// Character reference state
|
|
4706
4622
|
//------------------------------------------------------------------
|
|
4707
|
-
_stateCharacterReference(
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
// Named character reference state
|
|
4719
|
-
//------------------------------------------------------------------
|
|
4720
|
-
_stateNamedCharacterReference(cp) {
|
|
4721
|
-
const matchResult = this._matchNamedCharacterReference(cp);
|
|
4722
|
-
if (this._ensureHibernation()) {
|
|
4723
|
-
} else if (matchResult) {
|
|
4724
|
-
for (let i = 0; i < matchResult.length; i++) {
|
|
4725
|
-
this._flushCodePointConsumedAsCharacterReference(matchResult[i]);
|
|
4623
|
+
_stateCharacterReference() {
|
|
4624
|
+
let length = this.entityDecoder.write(this.preprocessor.html, this.preprocessor.pos);
|
|
4625
|
+
if (length < 0) {
|
|
4626
|
+
if (this.preprocessor.lastChunkWritten) {
|
|
4627
|
+
length = this.entityDecoder.end();
|
|
4628
|
+
} else {
|
|
4629
|
+
this.active = false;
|
|
4630
|
+
this.preprocessor.pos = this.preprocessor.html.length - 1;
|
|
4631
|
+
this.consumedAfterSnapshot = 0;
|
|
4632
|
+
this.preprocessor.endOfChunkHit = true;
|
|
4633
|
+
return;
|
|
4726
4634
|
}
|
|
4727
|
-
|
|
4728
|
-
|
|
4635
|
+
}
|
|
4636
|
+
if (length === 0) {
|
|
4637
|
+
this.preprocessor.pos = this.entityStartPos;
|
|
4729
4638
|
this._flushCodePointConsumedAsCharacterReference(CODE_POINTS.AMPERSAND);
|
|
4730
|
-
this.state = State.AMBIGUOUS_AMPERSAND;
|
|
4639
|
+
this.state = !this._isCharacterReferenceInAttribute() && isAsciiAlphaNumeric2(this.preprocessor.peek(1)) ? State.AMBIGUOUS_AMPERSAND : this.returnState;
|
|
4640
|
+
} else {
|
|
4641
|
+
this.state = this.returnState;
|
|
4731
4642
|
}
|
|
4732
4643
|
}
|
|
4733
4644
|
// Ambiguos ampersand state
|
|
@@ -4739,93 +4650,10 @@ var Tokenizer = class {
|
|
|
4739
4650
|
if (cp === CODE_POINTS.SEMICOLON) {
|
|
4740
4651
|
this._err(ERR.unknownNamedCharacterReference);
|
|
4741
4652
|
}
|
|
4742
|
-
this._reconsumeInState(this.returnState, cp);
|
|
4743
|
-
}
|
|
4744
|
-
}
|
|
4745
|
-
// Numeric character reference state
|
|
4746
|
-
//------------------------------------------------------------------
|
|
4747
|
-
_stateNumericCharacterReference(cp) {
|
|
4748
|
-
this.charRefCode = 0;
|
|
4749
|
-
if (cp === CODE_POINTS.LATIN_SMALL_X || cp === CODE_POINTS.LATIN_CAPITAL_X) {
|
|
4750
|
-
this.state = State.HEXADEMICAL_CHARACTER_REFERENCE_START;
|
|
4751
|
-
} else if (isAsciiDigit(cp)) {
|
|
4752
|
-
this.state = State.DECIMAL_CHARACTER_REFERENCE;
|
|
4753
|
-
this._stateDecimalCharacterReference(cp);
|
|
4754
|
-
} else {
|
|
4755
|
-
this._err(ERR.absenceOfDigitsInNumericCharacterReference);
|
|
4756
|
-
this._flushCodePointConsumedAsCharacterReference(CODE_POINTS.AMPERSAND);
|
|
4757
|
-
this._flushCodePointConsumedAsCharacterReference(CODE_POINTS.NUMBER_SIGN);
|
|
4758
|
-
this._reconsumeInState(this.returnState, cp);
|
|
4759
|
-
}
|
|
4760
|
-
}
|
|
4761
|
-
// Hexademical character reference start state
|
|
4762
|
-
//------------------------------------------------------------------
|
|
4763
|
-
_stateHexademicalCharacterReferenceStart(cp) {
|
|
4764
|
-
if (isAsciiHexDigit(cp)) {
|
|
4765
|
-
this.state = State.HEXADEMICAL_CHARACTER_REFERENCE;
|
|
4766
|
-
this._stateHexademicalCharacterReference(cp);
|
|
4767
|
-
} else {
|
|
4768
|
-
this._err(ERR.absenceOfDigitsInNumericCharacterReference);
|
|
4769
|
-
this._flushCodePointConsumedAsCharacterReference(CODE_POINTS.AMPERSAND);
|
|
4770
|
-
this._flushCodePointConsumedAsCharacterReference(CODE_POINTS.NUMBER_SIGN);
|
|
4771
|
-
this._unconsume(2);
|
|
4772
4653
|
this.state = this.returnState;
|
|
4654
|
+
this._callState(cp);
|
|
4773
4655
|
}
|
|
4774
4656
|
}
|
|
4775
|
-
// Hexademical character reference state
|
|
4776
|
-
//------------------------------------------------------------------
|
|
4777
|
-
_stateHexademicalCharacterReference(cp) {
|
|
4778
|
-
if (isAsciiUpperHexDigit(cp)) {
|
|
4779
|
-
this.charRefCode = this.charRefCode * 16 + cp - 55;
|
|
4780
|
-
} else if (isAsciiLowerHexDigit(cp)) {
|
|
4781
|
-
this.charRefCode = this.charRefCode * 16 + cp - 87;
|
|
4782
|
-
} else if (isAsciiDigit(cp)) {
|
|
4783
|
-
this.charRefCode = this.charRefCode * 16 + cp - 48;
|
|
4784
|
-
} else if (cp === CODE_POINTS.SEMICOLON) {
|
|
4785
|
-
this.state = State.NUMERIC_CHARACTER_REFERENCE_END;
|
|
4786
|
-
} else {
|
|
4787
|
-
this._err(ERR.missingSemicolonAfterCharacterReference);
|
|
4788
|
-
this.state = State.NUMERIC_CHARACTER_REFERENCE_END;
|
|
4789
|
-
this._stateNumericCharacterReferenceEnd(cp);
|
|
4790
|
-
}
|
|
4791
|
-
}
|
|
4792
|
-
// Decimal character reference state
|
|
4793
|
-
//------------------------------------------------------------------
|
|
4794
|
-
_stateDecimalCharacterReference(cp) {
|
|
4795
|
-
if (isAsciiDigit(cp)) {
|
|
4796
|
-
this.charRefCode = this.charRefCode * 10 + cp - 48;
|
|
4797
|
-
} else if (cp === CODE_POINTS.SEMICOLON) {
|
|
4798
|
-
this.state = State.NUMERIC_CHARACTER_REFERENCE_END;
|
|
4799
|
-
} else {
|
|
4800
|
-
this._err(ERR.missingSemicolonAfterCharacterReference);
|
|
4801
|
-
this.state = State.NUMERIC_CHARACTER_REFERENCE_END;
|
|
4802
|
-
this._stateNumericCharacterReferenceEnd(cp);
|
|
4803
|
-
}
|
|
4804
|
-
}
|
|
4805
|
-
// Numeric character reference end state
|
|
4806
|
-
//------------------------------------------------------------------
|
|
4807
|
-
_stateNumericCharacterReferenceEnd(cp) {
|
|
4808
|
-
if (this.charRefCode === CODE_POINTS.NULL) {
|
|
4809
|
-
this._err(ERR.nullCharacterReference);
|
|
4810
|
-
this.charRefCode = CODE_POINTS.REPLACEMENT_CHARACTER;
|
|
4811
|
-
} else if (this.charRefCode > 1114111) {
|
|
4812
|
-
this._err(ERR.characterReferenceOutsideUnicodeRange);
|
|
4813
|
-
this.charRefCode = CODE_POINTS.REPLACEMENT_CHARACTER;
|
|
4814
|
-
} else if (isSurrogate(this.charRefCode)) {
|
|
4815
|
-
this._err(ERR.surrogateCharacterReference);
|
|
4816
|
-
this.charRefCode = CODE_POINTS.REPLACEMENT_CHARACTER;
|
|
4817
|
-
} else if (isUndefinedCodePoint(this.charRefCode)) {
|
|
4818
|
-
this._err(ERR.noncharacterCharacterReference);
|
|
4819
|
-
} else if (isControlCodePoint(this.charRefCode) || this.charRefCode === CODE_POINTS.CARRIAGE_RETURN) {
|
|
4820
|
-
this._err(ERR.controlCharacterReference);
|
|
4821
|
-
const replacement = C1_CONTROLS_REFERENCE_REPLACEMENTS.get(this.charRefCode);
|
|
4822
|
-
if (replacement !== void 0) {
|
|
4823
|
-
this.charRefCode = replacement;
|
|
4824
|
-
}
|
|
4825
|
-
}
|
|
4826
|
-
this._flushCodePointConsumedAsCharacterReference(this.charRefCode);
|
|
4827
|
-
this._reconsumeInState(this.returnState, cp);
|
|
4828
|
-
}
|
|
4829
4657
|
};
|
|
4830
4658
|
|
|
4831
4659
|
// node_modules/parse5/dist/parser/open-element-stack.js
|
|
@@ -4841,31 +4669,25 @@ var IMPLICIT_END_TAG_REQUIRED_THOROUGHLY = /* @__PURE__ */ new Set([
|
|
|
4841
4669
|
TAG_ID.THEAD,
|
|
4842
4670
|
TAG_ID.TR
|
|
4843
4671
|
]);
|
|
4844
|
-
var
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
[TAG_ID.ANNOTATION_XML, NS.MATHML],
|
|
4855
|
-
[TAG_ID.MI, NS.MATHML],
|
|
4856
|
-
[TAG_ID.MN, NS.MATHML],
|
|
4857
|
-
[TAG_ID.MO, NS.MATHML],
|
|
4858
|
-
[TAG_ID.MS, NS.MATHML],
|
|
4859
|
-
[TAG_ID.MTEXT, NS.MATHML],
|
|
4860
|
-
[TAG_ID.DESC, NS.SVG],
|
|
4861
|
-
[TAG_ID.FOREIGN_OBJECT, NS.SVG],
|
|
4862
|
-
[TAG_ID.TITLE, NS.SVG]
|
|
4672
|
+
var SCOPING_ELEMENTS_HTML = /* @__PURE__ */ new Set([
|
|
4673
|
+
TAG_ID.APPLET,
|
|
4674
|
+
TAG_ID.CAPTION,
|
|
4675
|
+
TAG_ID.HTML,
|
|
4676
|
+
TAG_ID.MARQUEE,
|
|
4677
|
+
TAG_ID.OBJECT,
|
|
4678
|
+
TAG_ID.TABLE,
|
|
4679
|
+
TAG_ID.TD,
|
|
4680
|
+
TAG_ID.TEMPLATE,
|
|
4681
|
+
TAG_ID.TH
|
|
4863
4682
|
]);
|
|
4864
|
-
var
|
|
4865
|
-
var
|
|
4866
|
-
var
|
|
4867
|
-
var
|
|
4868
|
-
var
|
|
4683
|
+
var SCOPING_ELEMENTS_HTML_LIST = /* @__PURE__ */ new Set([...SCOPING_ELEMENTS_HTML, TAG_ID.OL, TAG_ID.UL]);
|
|
4684
|
+
var SCOPING_ELEMENTS_HTML_BUTTON = /* @__PURE__ */ new Set([...SCOPING_ELEMENTS_HTML, TAG_ID.BUTTON]);
|
|
4685
|
+
var SCOPING_ELEMENTS_MATHML = /* @__PURE__ */ new Set([TAG_ID.ANNOTATION_XML, TAG_ID.MI, TAG_ID.MN, TAG_ID.MO, TAG_ID.MS, TAG_ID.MTEXT]);
|
|
4686
|
+
var SCOPING_ELEMENTS_SVG = /* @__PURE__ */ new Set([TAG_ID.DESC, TAG_ID.FOREIGN_OBJECT, TAG_ID.TITLE]);
|
|
4687
|
+
var TABLE_ROW_CONTEXT = /* @__PURE__ */ new Set([TAG_ID.TR, TAG_ID.TEMPLATE, TAG_ID.HTML]);
|
|
4688
|
+
var TABLE_BODY_CONTEXT = /* @__PURE__ */ new Set([TAG_ID.TBODY, TAG_ID.TFOOT, TAG_ID.THEAD, TAG_ID.TEMPLATE, TAG_ID.HTML]);
|
|
4689
|
+
var TABLE_CONTEXT = /* @__PURE__ */ new Set([TAG_ID.TABLE, TAG_ID.TEMPLATE, TAG_ID.HTML]);
|
|
4690
|
+
var TABLE_CELLS = /* @__PURE__ */ new Set([TAG_ID.TD, TAG_ID.TH]);
|
|
4869
4691
|
var OpenElementStack = class {
|
|
4870
4692
|
get currentTmplContentOrNode() {
|
|
4871
4693
|
return this._isInTemplate() ? this.treeAdapter.getTemplateContent(this.current) : this.current;
|
|
@@ -4957,7 +4779,7 @@ var OpenElementStack = class {
|
|
|
4957
4779
|
this.shortenToLength(idx < 0 ? 0 : idx);
|
|
4958
4780
|
}
|
|
4959
4781
|
popUntilNumberedHeaderPopped() {
|
|
4960
|
-
this.popUntilPopped(
|
|
4782
|
+
this.popUntilPopped(NUMBERED_HEADERS, NS.HTML);
|
|
4961
4783
|
}
|
|
4962
4784
|
popUntilTableCellPopped() {
|
|
4963
4785
|
this.popUntilPopped(TABLE_CELLS, NS.HTML);
|
|
@@ -4968,7 +4790,7 @@ var OpenElementStack = class {
|
|
|
4968
4790
|
}
|
|
4969
4791
|
_indexOfTagNames(tagNames, namespace) {
|
|
4970
4792
|
for (let i = this.stackTop; i >= 0; i--) {
|
|
4971
|
-
if (tagNames.
|
|
4793
|
+
if (tagNames.has(this.tagIDs[i]) && this.treeAdapter.getNamespaceURI(this.items[i]) === namespace) {
|
|
4972
4794
|
return i;
|
|
4973
4795
|
}
|
|
4974
4796
|
}
|
|
@@ -5016,102 +4838,117 @@ var OpenElementStack = class {
|
|
|
5016
4838
|
return this.stackTop === 0 && this.tagIDs[0] === TAG_ID.HTML;
|
|
5017
4839
|
}
|
|
5018
4840
|
//Element in scope
|
|
5019
|
-
|
|
4841
|
+
hasInDynamicScope(tagName, htmlScope) {
|
|
5020
4842
|
for (let i = this.stackTop; i >= 0; i--) {
|
|
5021
4843
|
const tn = this.tagIDs[i];
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
4844
|
+
switch (this.treeAdapter.getNamespaceURI(this.items[i])) {
|
|
4845
|
+
case NS.HTML: {
|
|
4846
|
+
if (tn === tagName)
|
|
4847
|
+
return true;
|
|
4848
|
+
if (htmlScope.has(tn))
|
|
4849
|
+
return false;
|
|
4850
|
+
break;
|
|
4851
|
+
}
|
|
4852
|
+
case NS.SVG: {
|
|
4853
|
+
if (SCOPING_ELEMENTS_SVG.has(tn))
|
|
4854
|
+
return false;
|
|
4855
|
+
break;
|
|
4856
|
+
}
|
|
4857
|
+
case NS.MATHML: {
|
|
4858
|
+
if (SCOPING_ELEMENTS_MATHML.has(tn))
|
|
4859
|
+
return false;
|
|
4860
|
+
break;
|
|
4861
|
+
}
|
|
5028
4862
|
}
|
|
5029
4863
|
}
|
|
5030
4864
|
return true;
|
|
5031
4865
|
}
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
const tn = this.tagIDs[i];
|
|
5035
|
-
const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
|
|
5036
|
-
if (isNumberedHeader(tn) && ns === NS.HTML) {
|
|
5037
|
-
return true;
|
|
5038
|
-
}
|
|
5039
|
-
if (SCOPING_ELEMENT_NS.get(tn) === ns) {
|
|
5040
|
-
return false;
|
|
5041
|
-
}
|
|
5042
|
-
}
|
|
5043
|
-
return true;
|
|
4866
|
+
hasInScope(tagName) {
|
|
4867
|
+
return this.hasInDynamicScope(tagName, SCOPING_ELEMENTS_HTML);
|
|
5044
4868
|
}
|
|
5045
4869
|
hasInListItemScope(tagName) {
|
|
5046
|
-
|
|
5047
|
-
const tn = this.tagIDs[i];
|
|
5048
|
-
const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
|
|
5049
|
-
if (tn === tagName && ns === NS.HTML) {
|
|
5050
|
-
return true;
|
|
5051
|
-
}
|
|
5052
|
-
if ((tn === TAG_ID.UL || tn === TAG_ID.OL) && ns === NS.HTML || SCOPING_ELEMENT_NS.get(tn) === ns) {
|
|
5053
|
-
return false;
|
|
5054
|
-
}
|
|
5055
|
-
}
|
|
5056
|
-
return true;
|
|
4870
|
+
return this.hasInDynamicScope(tagName, SCOPING_ELEMENTS_HTML_LIST);
|
|
5057
4871
|
}
|
|
5058
4872
|
hasInButtonScope(tagName) {
|
|
4873
|
+
return this.hasInDynamicScope(tagName, SCOPING_ELEMENTS_HTML_BUTTON);
|
|
4874
|
+
}
|
|
4875
|
+
hasNumberedHeaderInScope() {
|
|
5059
4876
|
for (let i = this.stackTop; i >= 0; i--) {
|
|
5060
4877
|
const tn = this.tagIDs[i];
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
4878
|
+
switch (this.treeAdapter.getNamespaceURI(this.items[i])) {
|
|
4879
|
+
case NS.HTML: {
|
|
4880
|
+
if (NUMBERED_HEADERS.has(tn))
|
|
4881
|
+
return true;
|
|
4882
|
+
if (SCOPING_ELEMENTS_HTML.has(tn))
|
|
4883
|
+
return false;
|
|
4884
|
+
break;
|
|
4885
|
+
}
|
|
4886
|
+
case NS.SVG: {
|
|
4887
|
+
if (SCOPING_ELEMENTS_SVG.has(tn))
|
|
4888
|
+
return false;
|
|
4889
|
+
break;
|
|
4890
|
+
}
|
|
4891
|
+
case NS.MATHML: {
|
|
4892
|
+
if (SCOPING_ELEMENTS_MATHML.has(tn))
|
|
4893
|
+
return false;
|
|
4894
|
+
break;
|
|
4895
|
+
}
|
|
5067
4896
|
}
|
|
5068
4897
|
}
|
|
5069
4898
|
return true;
|
|
5070
4899
|
}
|
|
5071
4900
|
hasInTableScope(tagName) {
|
|
5072
4901
|
for (let i = this.stackTop; i >= 0; i--) {
|
|
5073
|
-
|
|
5074
|
-
const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
|
|
5075
|
-
if (ns !== NS.HTML) {
|
|
4902
|
+
if (this.treeAdapter.getNamespaceURI(this.items[i]) !== NS.HTML) {
|
|
5076
4903
|
continue;
|
|
5077
4904
|
}
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
4905
|
+
switch (this.tagIDs[i]) {
|
|
4906
|
+
case tagName: {
|
|
4907
|
+
return true;
|
|
4908
|
+
}
|
|
4909
|
+
case TAG_ID.TABLE:
|
|
4910
|
+
case TAG_ID.HTML: {
|
|
4911
|
+
return false;
|
|
4912
|
+
}
|
|
5083
4913
|
}
|
|
5084
4914
|
}
|
|
5085
4915
|
return true;
|
|
5086
4916
|
}
|
|
5087
4917
|
hasTableBodyContextInTableScope() {
|
|
5088
4918
|
for (let i = this.stackTop; i >= 0; i--) {
|
|
5089
|
-
|
|
5090
|
-
const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
|
|
5091
|
-
if (ns !== NS.HTML) {
|
|
4919
|
+
if (this.treeAdapter.getNamespaceURI(this.items[i]) !== NS.HTML) {
|
|
5092
4920
|
continue;
|
|
5093
4921
|
}
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
4922
|
+
switch (this.tagIDs[i]) {
|
|
4923
|
+
case TAG_ID.TBODY:
|
|
4924
|
+
case TAG_ID.THEAD:
|
|
4925
|
+
case TAG_ID.TFOOT: {
|
|
4926
|
+
return true;
|
|
4927
|
+
}
|
|
4928
|
+
case TAG_ID.TABLE:
|
|
4929
|
+
case TAG_ID.HTML: {
|
|
4930
|
+
return false;
|
|
4931
|
+
}
|
|
5099
4932
|
}
|
|
5100
4933
|
}
|
|
5101
4934
|
return true;
|
|
5102
4935
|
}
|
|
5103
4936
|
hasInSelectScope(tagName) {
|
|
5104
4937
|
for (let i = this.stackTop; i >= 0; i--) {
|
|
5105
|
-
|
|
5106
|
-
const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
|
|
5107
|
-
if (ns !== NS.HTML) {
|
|
4938
|
+
if (this.treeAdapter.getNamespaceURI(this.items[i]) !== NS.HTML) {
|
|
5108
4939
|
continue;
|
|
5109
4940
|
}
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
4941
|
+
switch (this.tagIDs[i]) {
|
|
4942
|
+
case tagName: {
|
|
4943
|
+
return true;
|
|
4944
|
+
}
|
|
4945
|
+
case TAG_ID.OPTION:
|
|
4946
|
+
case TAG_ID.OPTGROUP: {
|
|
4947
|
+
break;
|
|
4948
|
+
}
|
|
4949
|
+
default: {
|
|
4950
|
+
return false;
|
|
4951
|
+
}
|
|
5115
4952
|
}
|
|
5116
4953
|
}
|
|
5117
4954
|
return true;
|
|
@@ -5140,7 +4977,7 @@ var EntryType;
|
|
|
5140
4977
|
(function(EntryType2) {
|
|
5141
4978
|
EntryType2[EntryType2["Marker"] = 0] = "Marker";
|
|
5142
4979
|
EntryType2[EntryType2["Element"] = 1] = "Element";
|
|
5143
|
-
})(EntryType
|
|
4980
|
+
})(EntryType || (EntryType = {}));
|
|
5144
4981
|
var MARKER = { type: EntryType.Marker };
|
|
5145
4982
|
var FormattingElementList = class {
|
|
5146
4983
|
constructor(treeAdapter) {
|
|
@@ -5240,13 +5077,6 @@ var FormattingElementList = class {
|
|
|
5240
5077
|
};
|
|
5241
5078
|
|
|
5242
5079
|
// node_modules/parse5/dist/tree-adapters/default.js
|
|
5243
|
-
function createTextNode(value) {
|
|
5244
|
-
return {
|
|
5245
|
-
nodeName: "#text",
|
|
5246
|
-
value,
|
|
5247
|
-
parentNode: null
|
|
5248
|
-
};
|
|
5249
|
-
}
|
|
5250
5080
|
var defaultTreeAdapter = {
|
|
5251
5081
|
//Node construction
|
|
5252
5082
|
createDocument() {
|
|
@@ -5279,6 +5109,13 @@ var defaultTreeAdapter = {
|
|
|
5279
5109
|
parentNode: null
|
|
5280
5110
|
};
|
|
5281
5111
|
},
|
|
5112
|
+
createTextNode(value) {
|
|
5113
|
+
return {
|
|
5114
|
+
nodeName: "#text",
|
|
5115
|
+
value,
|
|
5116
|
+
parentNode: null
|
|
5117
|
+
};
|
|
5118
|
+
},
|
|
5282
5119
|
//Tree mutation
|
|
5283
5120
|
appendChild(parentNode, newNode) {
|
|
5284
5121
|
parentNode.childNodes.push(newNode);
|
|
@@ -5333,14 +5170,14 @@ var defaultTreeAdapter = {
|
|
|
5333
5170
|
return;
|
|
5334
5171
|
}
|
|
5335
5172
|
}
|
|
5336
|
-
defaultTreeAdapter.appendChild(parentNode, createTextNode(text));
|
|
5173
|
+
defaultTreeAdapter.appendChild(parentNode, defaultTreeAdapter.createTextNode(text));
|
|
5337
5174
|
},
|
|
5338
5175
|
insertTextBefore(parentNode, text, referenceNode) {
|
|
5339
5176
|
const prevNode = parentNode.childNodes[parentNode.childNodes.indexOf(referenceNode) - 1];
|
|
5340
5177
|
if (prevNode && defaultTreeAdapter.isTextNode(prevNode)) {
|
|
5341
5178
|
prevNode.value += text;
|
|
5342
5179
|
} else {
|
|
5343
|
-
defaultTreeAdapter.insertBefore(parentNode, createTextNode(text), referenceNode);
|
|
5180
|
+
defaultTreeAdapter.insertBefore(parentNode, defaultTreeAdapter.createTextNode(text), referenceNode);
|
|
5344
5181
|
}
|
|
5345
5182
|
},
|
|
5346
5183
|
adoptAttributes(recipient, attrs) {
|
|
@@ -5605,7 +5442,6 @@ var XML_ATTRS_ADJUSTMENT_MAP = /* @__PURE__ */ new Map([
|
|
|
5605
5442
|
["xlink:show", { prefix: "xlink", name: "show", namespace: NS.XLINK }],
|
|
5606
5443
|
["xlink:title", { prefix: "xlink", name: "title", namespace: NS.XLINK }],
|
|
5607
5444
|
["xlink:type", { prefix: "xlink", name: "type", namespace: NS.XLINK }],
|
|
5608
|
-
["xml:base", { prefix: "xml", name: "base", namespace: NS.XML }],
|
|
5609
5445
|
["xml:lang", { prefix: "xml", name: "lang", namespace: NS.XML }],
|
|
5610
5446
|
["xml:space", { prefix: "xml", name: "space", namespace: NS.XML }],
|
|
5611
5447
|
["xmlns", { prefix: "", name: "xmlns", namespace: NS.XMLNS }],
|
|
@@ -5859,6 +5695,7 @@ var Parser = class {
|
|
|
5859
5695
|
return fragment;
|
|
5860
5696
|
}
|
|
5861
5697
|
//Errors
|
|
5698
|
+
/** @internal */
|
|
5862
5699
|
_err(token, code, beforeToken) {
|
|
5863
5700
|
var _a2;
|
|
5864
5701
|
if (!this.onParseError)
|
|
@@ -5876,12 +5713,14 @@ var Parser = class {
|
|
|
5876
5713
|
this.onParseError(err2);
|
|
5877
5714
|
}
|
|
5878
5715
|
//Stack events
|
|
5716
|
+
/** @internal */
|
|
5879
5717
|
onItemPush(node, tid, isTop) {
|
|
5880
5718
|
var _a2, _b;
|
|
5881
5719
|
(_b = (_a2 = this.treeAdapter).onItemPush) === null || _b === void 0 ? void 0 : _b.call(_a2, node);
|
|
5882
5720
|
if (isTop && this.openElements.stackTop > 0)
|
|
5883
5721
|
this._setContextModes(node, tid);
|
|
5884
5722
|
}
|
|
5723
|
+
/** @internal */
|
|
5885
5724
|
onItemPop(node, isTop) {
|
|
5886
5725
|
var _a2, _b;
|
|
5887
5726
|
if (this.options.sourceCodeLocationInfo) {
|
|
@@ -5905,6 +5744,7 @@ var Parser = class {
|
|
|
5905
5744
|
this.currentNotInHTML = !isHTML;
|
|
5906
5745
|
this.tokenizer.inForeignNode = !isHTML && !this._isIntegrationPoint(tid, current);
|
|
5907
5746
|
}
|
|
5747
|
+
/** @protected */
|
|
5908
5748
|
_switchToTextParsing(currentToken, nextTokenizerState) {
|
|
5909
5749
|
this._insertElement(currentToken, NS.HTML);
|
|
5910
5750
|
this.tokenizer.state = nextTokenizerState;
|
|
@@ -5917,9 +5757,11 @@ var Parser = class {
|
|
|
5917
5757
|
this.tokenizer.state = TokenizerMode.PLAINTEXT;
|
|
5918
5758
|
}
|
|
5919
5759
|
//Fragment parsing
|
|
5760
|
+
/** @protected */
|
|
5920
5761
|
_getAdjustedCurrentElement() {
|
|
5921
5762
|
return this.openElements.stackTop === 0 && this.fragmentContext ? this.fragmentContext : this.openElements.current;
|
|
5922
5763
|
}
|
|
5764
|
+
/** @protected */
|
|
5923
5765
|
_findFormInFragmentContext() {
|
|
5924
5766
|
let node = this.fragmentContext;
|
|
5925
5767
|
while (node) {
|
|
@@ -5961,6 +5803,7 @@ var Parser = class {
|
|
|
5961
5803
|
}
|
|
5962
5804
|
}
|
|
5963
5805
|
//Tree mutation
|
|
5806
|
+
/** @protected */
|
|
5964
5807
|
_setDocumentType(token) {
|
|
5965
5808
|
const name = token.name || "";
|
|
5966
5809
|
const publicId = token.publicId || "";
|
|
@@ -5974,6 +5817,7 @@ var Parser = class {
|
|
|
5974
5817
|
}
|
|
5975
5818
|
}
|
|
5976
5819
|
}
|
|
5820
|
+
/** @protected */
|
|
5977
5821
|
_attachElementToTree(element, location2) {
|
|
5978
5822
|
if (this.options.sourceCodeLocationInfo) {
|
|
5979
5823
|
const loc = location2 && {
|
|
@@ -5989,20 +5833,28 @@ var Parser = class {
|
|
|
5989
5833
|
this.treeAdapter.appendChild(parent, element);
|
|
5990
5834
|
}
|
|
5991
5835
|
}
|
|
5836
|
+
/**
|
|
5837
|
+
* For self-closing tags. Add an element to the tree, but skip adding it
|
|
5838
|
+
* to the stack.
|
|
5839
|
+
*/
|
|
5840
|
+
/** @protected */
|
|
5992
5841
|
_appendElement(token, namespaceURI) {
|
|
5993
5842
|
const element = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs);
|
|
5994
5843
|
this._attachElementToTree(element, token.location);
|
|
5995
5844
|
}
|
|
5845
|
+
/** @protected */
|
|
5996
5846
|
_insertElement(token, namespaceURI) {
|
|
5997
5847
|
const element = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs);
|
|
5998
5848
|
this._attachElementToTree(element, token.location);
|
|
5999
5849
|
this.openElements.push(element, token.tagID);
|
|
6000
5850
|
}
|
|
5851
|
+
/** @protected */
|
|
6001
5852
|
_insertFakeElement(tagName, tagID) {
|
|
6002
5853
|
const element = this.treeAdapter.createElement(tagName, NS.HTML, []);
|
|
6003
5854
|
this._attachElementToTree(element, null);
|
|
6004
5855
|
this.openElements.push(element, tagID);
|
|
6005
5856
|
}
|
|
5857
|
+
/** @protected */
|
|
6006
5858
|
_insertTemplate(token) {
|
|
6007
5859
|
const tmpl = this.treeAdapter.createElement(token.tagName, NS.HTML, token.attrs);
|
|
6008
5860
|
const content = this.treeAdapter.createDocumentFragment();
|
|
@@ -6012,6 +5864,7 @@ var Parser = class {
|
|
|
6012
5864
|
if (this.options.sourceCodeLocationInfo)
|
|
6013
5865
|
this.treeAdapter.setNodeSourceCodeLocation(content, null);
|
|
6014
5866
|
}
|
|
5867
|
+
/** @protected */
|
|
6015
5868
|
_insertFakeRootElement() {
|
|
6016
5869
|
const element = this.treeAdapter.createElement(TAG_NAMES.HTML, NS.HTML, []);
|
|
6017
5870
|
if (this.options.sourceCodeLocationInfo)
|
|
@@ -6019,6 +5872,7 @@ var Parser = class {
|
|
|
6019
5872
|
this.treeAdapter.appendChild(this.openElements.current, element);
|
|
6020
5873
|
this.openElements.push(element, TAG_ID.HTML);
|
|
6021
5874
|
}
|
|
5875
|
+
/** @protected */
|
|
6022
5876
|
_appendCommentNode(token, parent) {
|
|
6023
5877
|
const commentNode = this.treeAdapter.createCommentNode(token.data);
|
|
6024
5878
|
this.treeAdapter.appendChild(parent, commentNode);
|
|
@@ -6026,6 +5880,7 @@ var Parser = class {
|
|
|
6026
5880
|
this.treeAdapter.setNodeSourceCodeLocation(commentNode, token.location);
|
|
6027
5881
|
}
|
|
6028
5882
|
}
|
|
5883
|
+
/** @protected */
|
|
6029
5884
|
_insertCharacters(token) {
|
|
6030
5885
|
let parent;
|
|
6031
5886
|
let beforeElement;
|
|
@@ -6053,12 +5908,14 @@ var Parser = class {
|
|
|
6053
5908
|
this.treeAdapter.setNodeSourceCodeLocation(textNode, token.location);
|
|
6054
5909
|
}
|
|
6055
5910
|
}
|
|
5911
|
+
/** @protected */
|
|
6056
5912
|
_adoptNodes(donor, recipient) {
|
|
6057
5913
|
for (let child = this.treeAdapter.getFirstChild(donor); child; child = this.treeAdapter.getFirstChild(donor)) {
|
|
6058
5914
|
this.treeAdapter.detachNode(child);
|
|
6059
5915
|
this.treeAdapter.appendChild(recipient, child);
|
|
6060
5916
|
}
|
|
6061
5917
|
}
|
|
5918
|
+
/** @protected */
|
|
6062
5919
|
_setEndLocation(element, closingToken) {
|
|
6063
5920
|
if (this.treeAdapter.getNodeSourceCodeLocation(element) && closingToken.location) {
|
|
6064
5921
|
const ctLoc = closingToken.location;
|
|
@@ -6102,6 +5959,7 @@ var Parser = class {
|
|
|
6102
5959
|
(token.tagID === TAG_ID.MGLYPH || token.tagID === TAG_ID.MALIGNMARK) && !this._isIntegrationPoint(currentTagId, current, NS.HTML)
|
|
6103
5960
|
);
|
|
6104
5961
|
}
|
|
5962
|
+
/** @protected */
|
|
6105
5963
|
_processToken(token) {
|
|
6106
5964
|
switch (token.type) {
|
|
6107
5965
|
case TokenType.CHARACTER: {
|
|
@@ -6139,12 +5997,14 @@ var Parser = class {
|
|
|
6139
5997
|
}
|
|
6140
5998
|
}
|
|
6141
5999
|
//Integration points
|
|
6000
|
+
/** @protected */
|
|
6142
6001
|
_isIntegrationPoint(tid, element, foreignNS) {
|
|
6143
6002
|
const ns = this.treeAdapter.getNamespaceURI(element);
|
|
6144
6003
|
const attrs = this.treeAdapter.getAttrList(element);
|
|
6145
6004
|
return isIntegrationPoint(tid, ns, attrs, foreignNS);
|
|
6146
6005
|
}
|
|
6147
6006
|
//Active formatting elements reconstruction
|
|
6007
|
+
/** @protected */
|
|
6148
6008
|
_reconstructActiveFormattingElements() {
|
|
6149
6009
|
const listLength = this.activeFormattingElements.entries.length;
|
|
6150
6010
|
if (listLength) {
|
|
@@ -6158,17 +6018,20 @@ var Parser = class {
|
|
|
6158
6018
|
}
|
|
6159
6019
|
}
|
|
6160
6020
|
//Close elements
|
|
6021
|
+
/** @protected */
|
|
6161
6022
|
_closeTableCell() {
|
|
6162
6023
|
this.openElements.generateImpliedEndTags();
|
|
6163
6024
|
this.openElements.popUntilTableCellPopped();
|
|
6164
6025
|
this.activeFormattingElements.clearToLastMarker();
|
|
6165
6026
|
this.insertionMode = InsertionMode.IN_ROW;
|
|
6166
6027
|
}
|
|
6028
|
+
/** @protected */
|
|
6167
6029
|
_closePElement() {
|
|
6168
6030
|
this.openElements.generateImpliedEndTagsWithExclusion(TAG_ID.P);
|
|
6169
6031
|
this.openElements.popUntilTagNamePopped(TAG_ID.P);
|
|
6170
6032
|
}
|
|
6171
6033
|
//Insertion modes
|
|
6034
|
+
/** @protected */
|
|
6172
6035
|
_resetInsertionMode() {
|
|
6173
6036
|
for (let i = this.openElements.stackTop; i >= 0; i--) {
|
|
6174
6037
|
switch (i === 0 && this.fragmentContext ? this.fragmentContextID : this.openElements.tagIDs[i]) {
|
|
@@ -6233,6 +6096,7 @@ var Parser = class {
|
|
|
6233
6096
|
}
|
|
6234
6097
|
this.insertionMode = InsertionMode.IN_BODY;
|
|
6235
6098
|
}
|
|
6099
|
+
/** @protected */
|
|
6236
6100
|
_resetInsertionModeForSelect(selectIdx) {
|
|
6237
6101
|
if (selectIdx > 0) {
|
|
6238
6102
|
for (let i = selectIdx - 1; i > 0; i--) {
|
|
@@ -6248,12 +6112,15 @@ var Parser = class {
|
|
|
6248
6112
|
this.insertionMode = InsertionMode.IN_SELECT;
|
|
6249
6113
|
}
|
|
6250
6114
|
//Foster parenting
|
|
6115
|
+
/** @protected */
|
|
6251
6116
|
_isElementCausesFosterParenting(tn) {
|
|
6252
6117
|
return TABLE_STRUCTURE_TAGS.has(tn);
|
|
6253
6118
|
}
|
|
6119
|
+
/** @protected */
|
|
6254
6120
|
_shouldFosterParentOnInsertion() {
|
|
6255
6121
|
return this.fosterParentingEnabled && this._isElementCausesFosterParenting(this.openElements.currentTagId);
|
|
6256
6122
|
}
|
|
6123
|
+
/** @protected */
|
|
6257
6124
|
_findFosterParentingLocation() {
|
|
6258
6125
|
for (let i = this.openElements.stackTop; i >= 0; i--) {
|
|
6259
6126
|
const openElement = this.openElements.items[i];
|
|
@@ -6276,6 +6143,7 @@ var Parser = class {
|
|
|
6276
6143
|
}
|
|
6277
6144
|
return { parent: this.openElements.items[0], beforeElement: null };
|
|
6278
6145
|
}
|
|
6146
|
+
/** @protected */
|
|
6279
6147
|
_fosterParentElement(element) {
|
|
6280
6148
|
const location2 = this._findFosterParentingLocation();
|
|
6281
6149
|
if (location2.beforeElement) {
|
|
@@ -6285,10 +6153,12 @@ var Parser = class {
|
|
|
6285
6153
|
}
|
|
6286
6154
|
}
|
|
6287
6155
|
//Special elements
|
|
6156
|
+
/** @protected */
|
|
6288
6157
|
_isSpecialElement(element, id) {
|
|
6289
6158
|
const ns = this.treeAdapter.getNamespaceURI(element);
|
|
6290
6159
|
return SPECIAL_ELEMENTS[ns].has(id);
|
|
6291
6160
|
}
|
|
6161
|
+
/** @internal */
|
|
6292
6162
|
onCharacter(token) {
|
|
6293
6163
|
this.skipNextNewLine = false;
|
|
6294
6164
|
if (this.tokenizer.inForeignNode) {
|
|
@@ -6358,6 +6228,7 @@ var Parser = class {
|
|
|
6358
6228
|
default:
|
|
6359
6229
|
}
|
|
6360
6230
|
}
|
|
6231
|
+
/** @internal */
|
|
6361
6232
|
onNullCharacter(token) {
|
|
6362
6233
|
this.skipNextNewLine = false;
|
|
6363
6234
|
if (this.tokenizer.inForeignNode) {
|
|
@@ -6414,6 +6285,7 @@ var Parser = class {
|
|
|
6414
6285
|
default:
|
|
6415
6286
|
}
|
|
6416
6287
|
}
|
|
6288
|
+
/** @internal */
|
|
6417
6289
|
onComment(token) {
|
|
6418
6290
|
this.skipNextNewLine = false;
|
|
6419
6291
|
if (this.currentNotInHTML) {
|
|
@@ -6458,6 +6330,7 @@ var Parser = class {
|
|
|
6458
6330
|
default:
|
|
6459
6331
|
}
|
|
6460
6332
|
}
|
|
6333
|
+
/** @internal */
|
|
6461
6334
|
onDoctype(token) {
|
|
6462
6335
|
this.skipNextNewLine = false;
|
|
6463
6336
|
switch (this.insertionMode) {
|
|
@@ -6479,6 +6352,7 @@ var Parser = class {
|
|
|
6479
6352
|
default:
|
|
6480
6353
|
}
|
|
6481
6354
|
}
|
|
6355
|
+
/** @internal */
|
|
6482
6356
|
onStartTag(token) {
|
|
6483
6357
|
this.skipNextNewLine = false;
|
|
6484
6358
|
this.currentToken = token;
|
|
@@ -6496,6 +6370,7 @@ var Parser = class {
|
|
|
6496
6370
|
* for nested calls.
|
|
6497
6371
|
*
|
|
6498
6372
|
* @param token The token to process.
|
|
6373
|
+
* @protected
|
|
6499
6374
|
*/
|
|
6500
6375
|
_processStartTag(token) {
|
|
6501
6376
|
if (this.shouldProcessStartTagTokenInForeignContent(token)) {
|
|
@@ -6504,6 +6379,7 @@ var Parser = class {
|
|
|
6504
6379
|
this._startTagOutsideForeignContent(token);
|
|
6505
6380
|
}
|
|
6506
6381
|
}
|
|
6382
|
+
/** @protected */
|
|
6507
6383
|
_startTagOutsideForeignContent(token) {
|
|
6508
6384
|
switch (this.insertionMode) {
|
|
6509
6385
|
case InsertionMode.INITIAL: {
|
|
@@ -6597,6 +6473,7 @@ var Parser = class {
|
|
|
6597
6473
|
default:
|
|
6598
6474
|
}
|
|
6599
6475
|
}
|
|
6476
|
+
/** @internal */
|
|
6600
6477
|
onEndTag(token) {
|
|
6601
6478
|
this.skipNextNewLine = false;
|
|
6602
6479
|
this.currentToken = token;
|
|
@@ -6606,6 +6483,7 @@ var Parser = class {
|
|
|
6606
6483
|
this._endTagOutsideForeignContent(token);
|
|
6607
6484
|
}
|
|
6608
6485
|
}
|
|
6486
|
+
/** @protected */
|
|
6609
6487
|
_endTagOutsideForeignContent(token) {
|
|
6610
6488
|
switch (this.insertionMode) {
|
|
6611
6489
|
case InsertionMode.INITIAL: {
|
|
@@ -6699,6 +6577,7 @@ var Parser = class {
|
|
|
6699
6577
|
default:
|
|
6700
6578
|
}
|
|
6701
6579
|
}
|
|
6580
|
+
/** @internal */
|
|
6702
6581
|
onEof(token) {
|
|
6703
6582
|
switch (this.insertionMode) {
|
|
6704
6583
|
case InsertionMode.INITIAL: {
|
|
@@ -6760,6 +6639,7 @@ var Parser = class {
|
|
|
6760
6639
|
default:
|
|
6761
6640
|
}
|
|
6762
6641
|
}
|
|
6642
|
+
/** @internal */
|
|
6763
6643
|
onWhitespaceCharacter(token) {
|
|
6764
6644
|
if (this.skipNextNewLine) {
|
|
6765
6645
|
this.skipNextNewLine = false;
|
|
@@ -7291,7 +7171,7 @@ function numberedHeaderStartTagInBody(p, token) {
|
|
|
7291
7171
|
if (p.openElements.hasInButtonScope(TAG_ID.P)) {
|
|
7292
7172
|
p._closePElement();
|
|
7293
7173
|
}
|
|
7294
|
-
if (
|
|
7174
|
+
if (NUMBERED_HEADERS.has(p.openElements.currentTagId)) {
|
|
7295
7175
|
p.openElements.pop();
|
|
7296
7176
|
}
|
|
7297
7177
|
p._insertElement(token, NS.HTML);
|
|
@@ -7445,7 +7325,7 @@ function iframeStartTagInBody(p, token) {
|
|
|
7445
7325
|
p.framesetOk = false;
|
|
7446
7326
|
p._switchToTextParsing(token, TokenizerMode.RAWTEXT);
|
|
7447
7327
|
}
|
|
7448
|
-
function
|
|
7328
|
+
function rawTextStartTagInBody(p, token) {
|
|
7449
7329
|
p._switchToTextParsing(token, TokenizerMode.RAWTEXT);
|
|
7450
7330
|
}
|
|
7451
7331
|
function selectStartTagInBody(p, token) {
|
|
@@ -7548,6 +7428,7 @@ function startTagInBody(p, token) {
|
|
|
7548
7428
|
case TAG_ID.DETAILS:
|
|
7549
7429
|
case TAG_ID.ADDRESS:
|
|
7550
7430
|
case TAG_ID.ARTICLE:
|
|
7431
|
+
case TAG_ID.SEARCH:
|
|
7551
7432
|
case TAG_ID.SECTION:
|
|
7552
7433
|
case TAG_ID.SUMMARY:
|
|
7553
7434
|
case TAG_ID.FIELDSET:
|
|
@@ -7671,8 +7552,9 @@ function startTagInBody(p, token) {
|
|
|
7671
7552
|
optgroupStartTagInBody(p, token);
|
|
7672
7553
|
break;
|
|
7673
7554
|
}
|
|
7674
|
-
case TAG_ID.NOEMBED:
|
|
7675
|
-
|
|
7555
|
+
case TAG_ID.NOEMBED:
|
|
7556
|
+
case TAG_ID.NOFRAMES: {
|
|
7557
|
+
rawTextStartTagInBody(p, token);
|
|
7676
7558
|
break;
|
|
7677
7559
|
}
|
|
7678
7560
|
case TAG_ID.FRAMESET: {
|
|
@@ -7685,7 +7567,7 @@ function startTagInBody(p, token) {
|
|
|
7685
7567
|
}
|
|
7686
7568
|
case TAG_ID.NOSCRIPT: {
|
|
7687
7569
|
if (p.options.scriptingEnabled) {
|
|
7688
|
-
|
|
7570
|
+
rawTextStartTagInBody(p, token);
|
|
7689
7571
|
} else {
|
|
7690
7572
|
genericStartTagInBody(p, token);
|
|
7691
7573
|
}
|
|
@@ -7851,6 +7733,7 @@ function endTagInBody(p, token) {
|
|
|
7851
7733
|
case TAG_ID.ADDRESS:
|
|
7852
7734
|
case TAG_ID.ARTICLE:
|
|
7853
7735
|
case TAG_ID.DETAILS:
|
|
7736
|
+
case TAG_ID.SEARCH:
|
|
7854
7737
|
case TAG_ID.SECTION:
|
|
7855
7738
|
case TAG_ID.SUMMARY:
|
|
7856
7739
|
case TAG_ID.LISTING:
|
|
@@ -8419,6 +8302,17 @@ function startTagInSelect(p, token) {
|
|
|
8419
8302
|
p._insertElement(token, NS.HTML);
|
|
8420
8303
|
break;
|
|
8421
8304
|
}
|
|
8305
|
+
case TAG_ID.HR: {
|
|
8306
|
+
if (p.openElements.currentTagId === TAG_ID.OPTION) {
|
|
8307
|
+
p.openElements.pop();
|
|
8308
|
+
}
|
|
8309
|
+
if (p.openElements.currentTagId === TAG_ID.OPTGROUP) {
|
|
8310
|
+
p.openElements.pop();
|
|
8311
|
+
}
|
|
8312
|
+
p._appendElement(token, NS.HTML);
|
|
8313
|
+
token.ackSelfClosing = true;
|
|
8314
|
+
break;
|
|
8315
|
+
}
|
|
8422
8316
|
case TAG_ID.INPUT:
|
|
8423
8317
|
case TAG_ID.KEYGEN:
|
|
8424
8318
|
case TAG_ID.TEXTAREA:
|