parse5 7.1.1 → 7.2.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.
Files changed (61) hide show
  1. package/dist/cjs/common/doctype.d.ts +0 -1
  2. package/dist/cjs/common/doctype.js +2 -4
  3. package/dist/cjs/common/error-codes.d.ts +1 -2
  4. package/dist/cjs/common/error-codes.js +1 -2
  5. package/dist/cjs/common/foreign-content.d.ts +0 -1
  6. package/dist/cjs/common/foreign-content.js +7 -9
  7. package/dist/cjs/common/html.d.ts +32 -31
  8. package/dist/cjs/common/html.js +41 -42
  9. package/dist/cjs/common/token.d.ts +1 -2
  10. package/dist/cjs/common/token.js +3 -4
  11. package/dist/cjs/common/unicode.d.ts +1 -8
  12. package/dist/cjs/common/unicode.js +7 -14
  13. package/dist/cjs/index.d.ts +2 -4
  14. package/dist/cjs/index.js +5 -6
  15. package/dist/cjs/parser/formatting-element-list.d.ts +1 -2
  16. package/dist/cjs/parser/formatting-element-list.js +1 -2
  17. package/dist/cjs/parser/index.d.ts +72 -8
  18. package/dist/cjs/parser/index.js +301 -119
  19. package/dist/cjs/parser/open-element-stack.d.ts +2 -2
  20. package/dist/cjs/parser/open-element-stack.js +98 -90
  21. package/dist/cjs/serializer/index.d.ts +1 -2
  22. package/dist/cjs/serializer/index.js +8 -9
  23. package/dist/cjs/tokenizer/index.d.ts +130 -131
  24. package/dist/cjs/tokenizer/index.js +89 -282
  25. package/dist/cjs/tokenizer/preprocessor.d.ts +3 -4
  26. package/dist/cjs/tokenizer/preprocessor.js +10 -8
  27. package/dist/cjs/tree-adapters/default.d.ts +4 -5
  28. package/dist/cjs/tree-adapters/default.js +9 -10
  29. package/dist/cjs/tree-adapters/interface.d.ts +7 -2
  30. package/dist/cjs/tree-adapters/interface.js +0 -1
  31. package/dist/common/doctype.d.ts +0 -1
  32. package/dist/common/doctype.js +0 -1
  33. package/dist/common/error-codes.d.ts +1 -2
  34. package/dist/common/error-codes.js +1 -2
  35. package/dist/common/foreign-content.d.ts +0 -1
  36. package/dist/common/foreign-content.js +0 -2
  37. package/dist/common/html.d.ts +32 -31
  38. package/dist/common/html.js +38 -38
  39. package/dist/common/token.d.ts +1 -2
  40. package/dist/common/token.js +1 -2
  41. package/dist/common/unicode.d.ts +1 -8
  42. package/dist/common/unicode.js +1 -8
  43. package/dist/index.d.ts +2 -4
  44. package/dist/index.js +1 -3
  45. package/dist/parser/formatting-element-list.d.ts +1 -2
  46. package/dist/parser/formatting-element-list.js +1 -2
  47. package/dist/parser/index.d.ts +72 -8
  48. package/dist/parser/index.js +302 -120
  49. package/dist/parser/open-element-stack.d.ts +2 -2
  50. package/dist/parser/open-element-stack.js +99 -91
  51. package/dist/serializer/index.d.ts +1 -2
  52. package/dist/serializer/index.js +6 -6
  53. package/dist/tokenizer/index.d.ts +130 -131
  54. package/dist/tokenizer/index.js +90 -283
  55. package/dist/tokenizer/preprocessor.d.ts +3 -4
  56. package/dist/tokenizer/preprocessor.js +10 -8
  57. package/dist/tree-adapters/default.d.ts +4 -5
  58. package/dist/tree-adapters/default.js +9 -10
  59. package/dist/tree-adapters/interface.d.ts +7 -2
  60. package/dist/tree-adapters/interface.js +0 -1
  61. package/package.json +4 -4
@@ -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, isNumberedHeader } from '../common/html.js';
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,33 +12,30 @@ const IMPLICIT_END_TAG_REQUIRED_THOROUGHLY = new Set([
12
12
  $.THEAD,
13
13
  $.TR,
14
14
  ]);
15
- const SCOPING_ELEMENT_NS = new Map([
16
- [$.APPLET, NS.HTML],
17
- [$.CAPTION, NS.HTML],
18
- [$.HTML, NS.HTML],
19
- [$.MARQUEE, NS.HTML],
20
- [$.OBJECT, NS.HTML],
21
- [$.TABLE, NS.HTML],
22
- [$.TD, NS.HTML],
23
- [$.TEMPLATE, NS.HTML],
24
- [$.TH, NS.HTML],
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 NAMED_HEADERS = [$.H1, $.H2, $.H3, $.H4, $.H5, $.H6];
36
- const TABLE_ROW_CONTEXT = [$.TR, $.TEMPLATE, $.HTML];
37
- const TABLE_BODY_CONTEXT = [$.TBODY, $.TFOOT, $.THEAD, $.TEMPLATE, $.HTML];
38
- const TABLE_CONTEXT = [$.TABLE, $.TEMPLATE, $.HTML];
39
- const TABLE_CELLS = [$.TD, $.TH];
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 {
36
+ get currentTmplContentOrNode() {
37
+ return this._isInTemplate() ? this.treeAdapter.getTemplateContent(this.current) : this.current;
38
+ }
42
39
  constructor(document, treeAdapter, handler) {
43
40
  this.treeAdapter = treeAdapter;
44
41
  this.handler = handler;
@@ -49,9 +46,6 @@ export class OpenElementStack {
49
46
  this.currentTagId = $.UNKNOWN;
50
47
  this.current = document;
51
48
  }
52
- get currentTmplContentOrNode() {
53
- return this._isInTemplate() ? this.treeAdapter.getTemplateContent(this.current) : this.current;
54
- }
55
49
  //Index of element
56
50
  _indexOf(element) {
57
51
  return this.items.lastIndexOf(element, this.stackTop);
@@ -129,7 +123,7 @@ export class OpenElementStack {
129
123
  this.shortenToLength(idx < 0 ? 0 : idx);
130
124
  }
131
125
  popUntilNumberedHeaderPopped() {
132
- this.popUntilPopped(NAMED_HEADERS, NS.HTML);
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.includes(this.tagIDs[i]) && this.treeAdapter.getNamespaceURI(this.items[i]) === namespace) {
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
- hasInScope(tagName) {
189
+ hasInDynamicScope(tagName, htmlScope) {
196
190
  for (let i = this.stackTop; i >= 0; i--) {
197
191
  const tn = this.tagIDs[i];
198
- const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
199
- if (tn === tagName && ns === NS.HTML) {
200
- return true;
201
- }
202
- if (SCOPING_ELEMENT_NS.get(tn) === ns) {
203
- return false;
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
- hasNumberedHeaderInScope() {
209
- for (let i = this.stackTop; i >= 0; i--) {
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
- for (let i = this.stackTop; i >= 0; i--) {
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
- const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
238
- if (tn === tagName && ns === NS.HTML) {
239
- return true;
240
- }
241
- if ((tn === $.BUTTON && ns === NS.HTML) || SCOPING_ELEMENT_NS.get(tn) === ns) {
242
- return false;
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
- const tn = this.tagIDs[i];
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
- if (tn === tagName) {
255
- return true;
256
- }
257
- if (tn === $.TABLE || tn === $.TEMPLATE || tn === $.HTML) {
258
- return false;
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
- const tn = this.tagIDs[i];
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
- if (tn === $.TBODY || tn === $.THEAD || tn === $.TFOOT) {
271
- return true;
272
- }
273
- if (tn === $.TABLE || tn === $.HTML) {
274
- return false;
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
- const tn = this.tagIDs[i];
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
- if (tn === tagName) {
287
- return true;
288
- }
289
- if (tn !== $.OPTION && tn !== $.OPTGROUP) {
290
- return false;
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
@@ -49,7 +49,7 @@ export declare function serialize<T extends TreeAdapterTypeMap = DefaultTreeAdap
49
49
  * const document = parse5.parseFragment('<div>Hello, <b>world</b>!</div>');
50
50
  *
51
51
  * // Serializes the <div> element.
52
- * const html = parse5.serializeOuter(document.childNodes[0]);
52
+ * const str = parse5.serializeOuter(document.childNodes[0]);
53
53
  *
54
54
  * console.log(str); //> '<div>Hello, <b>world</b>!</div>'
55
55
  * ```
@@ -58,4 +58,3 @@ export declare function serialize<T extends TreeAdapterTypeMap = DefaultTreeAdap
58
58
  * @param options Serialization options.
59
59
  */
60
60
  export declare function serializeOuter<T extends TreeAdapterTypeMap = DefaultTreeAdapterMap>(node: T['node'], options?: SerializerOptions<T>): string;
61
- //# sourceMappingURL=index.d.ts.map
@@ -68,7 +68,7 @@ export function serialize(node, options) {
68
68
  * const document = parse5.parseFragment('<div>Hello, <b>world</b>!</div>');
69
69
  *
70
70
  * // Serializes the <div> element.
71
- * const html = parse5.serializeOuter(document.childNodes[0]);
71
+ * const str = parse5.serializeOuter(document.childNodes[0]);
72
72
  *
73
73
  * console.log(str); //> '<div>Hello, <b>world</b>!</div>'
74
74
  * ```
@@ -120,10 +120,7 @@ function serializeAttributes(node, { treeAdapter }) {
120
120
  let html = '';
121
121
  for (const attr of treeAdapter.getAttrList(node)) {
122
122
  html += ' ';
123
- if (!attr.namespace) {
124
- html += attr.name;
125
- }
126
- else
123
+ if (attr.namespace) {
127
124
  switch (attr.namespace) {
128
125
  case NS.XML: {
129
126
  html += `xml:${attr.name}`;
@@ -144,6 +141,10 @@ function serializeAttributes(node, { treeAdapter }) {
144
141
  html += `${attr.prefix}:${attr.name}`;
145
142
  }
146
143
  }
144
+ }
145
+ else {
146
+ html += attr.name;
147
+ }
147
148
  html += `="${escapeAttribute(attr.value)}"`;
148
149
  }
149
150
  return html;
@@ -165,4 +166,3 @@ function serializeCommentNode(node, { treeAdapter }) {
165
166
  function serializeDocumentTypeNode(node, { treeAdapter }) {
166
167
  return `<!DOCTYPE ${treeAdapter.getDocumentTypeNodeName(node)}>`;
167
168
  }
168
- //# sourceMappingURL=index.js.map
@@ -1,6 +1,7 @@
1
1
  import { Preprocessor } from './preprocessor.js';
2
- import { type CharacterToken, type DoctypeToken, type TagToken, type EOFToken, type CommentToken } from '../common/token.js';
3
- import { type ParserErrorHandler } from '../common/error-codes.js';
2
+ import { type Token, type CharacterToken, type DoctypeToken, type TagToken, type EOFToken, type CommentToken, type Attribute, type Location } from '../common/token.js';
3
+ import { EntityDecoder } from 'entities/lib/decode.js';
4
+ import { ERR, type ParserErrorHandler } from '../common/error-codes.js';
4
5
  declare const enum State {
5
6
  DATA = 0,
6
7
  RCDATA = 1,
@@ -74,13 +75,7 @@ declare const enum State {
74
75
  CDATA_SECTION_BRACKET = 69,
75
76
  CDATA_SECTION_END = 70,
76
77
  CHARACTER_REFERENCE = 71,
77
- NAMED_CHARACTER_REFERENCE = 72,
78
- AMBIGUOUS_AMPERSAND = 73,
79
- NUMERIC_CHARACTER_REFERENCE = 74,
80
- HEXADEMICAL_CHARACTER_REFERENCE_START = 75,
81
- HEXADEMICAL_CHARACTER_REFERENCE = 76,
82
- DECIMAL_CHARACTER_REFERENCE = 77,
83
- NUMERIC_CHARACTER_REFERENCE_END = 78
78
+ AMBIGUOUS_AMPERSAND = 72
84
79
  }
85
80
  export declare const TokenizerMode: {
86
81
  readonly DATA: State.DATA;
@@ -105,12 +100,12 @@ export interface TokenHandler {
105
100
  onParseError?: ParserErrorHandler | null;
106
101
  }
107
102
  export declare class Tokenizer {
108
- private options;
109
- private handler;
103
+ protected options: TokenizerOptions;
104
+ protected handler: TokenHandler;
110
105
  preprocessor: Preprocessor;
111
- private paused;
106
+ protected paused: boolean;
112
107
  /** Ensures that the parsing loop isn't run multiple times at once. */
113
- private inLoop;
108
+ protected inLoop: boolean;
114
109
  /**
115
110
  * Indicates that the current adjusted node exists, is not an element in the HTML namespace,
116
111
  * and that it is not an integration point for either MathML or HTML.
@@ -121,128 +116,132 @@ export declare class Tokenizer {
121
116
  lastStartTagName: string;
122
117
  active: boolean;
123
118
  state: State;
124
- private returnState;
125
- private charRefCode;
126
- private consumedAfterSnapshot;
127
- private currentLocation;
128
- private currentCharacterToken;
129
- private currentToken;
130
- private currentAttr;
119
+ protected returnState: State;
120
+ /**
121
+ * We use `entities`' `EntityDecoder` to parse character references.
122
+ *
123
+ * All of the following states are handled by the `EntityDecoder`:
124
+ *
125
+ * - Named character reference state
126
+ * - Numeric character reference state
127
+ * - Hexademical character reference start state
128
+ * - Hexademical character reference state
129
+ * - Decimal character reference state
130
+ * - Numeric character reference end state
131
+ */
132
+ protected entityDecoder: EntityDecoder;
133
+ protected entityStartPos: number;
134
+ protected consumedAfterSnapshot: number;
135
+ protected currentLocation: Location | null;
136
+ protected currentCharacterToken: CharacterToken | null;
137
+ protected currentToken: Token | null;
138
+ protected currentAttr: Attribute;
131
139
  constructor(options: TokenizerOptions, handler: TokenHandler);
132
- private _err;
133
- private getCurrentLocation;
134
- private _runParsingLoop;
140
+ protected _err(code: ERR, cpOffset?: number): void;
141
+ protected getCurrentLocation(offset: number): Location | null;
142
+ protected _runParsingLoop(): void;
135
143
  pause(): void;
136
144
  resume(writeCallback?: () => void): void;
137
145
  write(chunk: string, isLastChunk: boolean, writeCallback?: () => void): void;
138
146
  insertHtmlAtCurrentPos(chunk: string): void;
139
- private _ensureHibernation;
140
- private _consume;
141
- private _unconsume;
142
- private _reconsumeInState;
143
- private _advanceBy;
144
- private _consumeSequenceIfMatch;
145
- private _createStartTagToken;
146
- private _createEndTagToken;
147
- private _createCommentToken;
148
- private _createDoctypeToken;
149
- private _createCharacterToken;
150
- private _createAttr;
151
- private _leaveAttrName;
152
- private _leaveAttrValue;
153
- private prepareToken;
154
- private emitCurrentTagToken;
155
- private emitCurrentComment;
156
- private emitCurrentDoctype;
157
- private _emitCurrentCharacterToken;
158
- private _emitEOFToken;
159
- private _appendCharToCurrentCharacterToken;
160
- private _emitCodePoint;
161
- private _emitChars;
162
- private _matchNamedCharacterReference;
163
- private _isCharacterReferenceInAttribute;
164
- private _flushCodePointConsumedAsCharacterReference;
165
- private _callState;
166
- private _stateData;
167
- private _stateRcdata;
168
- private _stateRawtext;
169
- private _stateScriptData;
170
- private _statePlaintext;
171
- private _stateTagOpen;
172
- private _stateEndTagOpen;
173
- private _stateTagName;
174
- private _stateRcdataLessThanSign;
175
- private _stateRcdataEndTagOpen;
176
- private handleSpecialEndTag;
177
- private _stateRcdataEndTagName;
178
- private _stateRawtextLessThanSign;
179
- private _stateRawtextEndTagOpen;
180
- private _stateRawtextEndTagName;
181
- private _stateScriptDataLessThanSign;
182
- private _stateScriptDataEndTagOpen;
183
- private _stateScriptDataEndTagName;
184
- private _stateScriptDataEscapeStart;
185
- private _stateScriptDataEscapeStartDash;
186
- private _stateScriptDataEscaped;
187
- private _stateScriptDataEscapedDash;
188
- private _stateScriptDataEscapedDashDash;
189
- private _stateScriptDataEscapedLessThanSign;
190
- private _stateScriptDataEscapedEndTagOpen;
191
- private _stateScriptDataEscapedEndTagName;
192
- private _stateScriptDataDoubleEscapeStart;
193
- private _stateScriptDataDoubleEscaped;
194
- private _stateScriptDataDoubleEscapedDash;
195
- private _stateScriptDataDoubleEscapedDashDash;
196
- private _stateScriptDataDoubleEscapedLessThanSign;
197
- private _stateScriptDataDoubleEscapeEnd;
198
- private _stateBeforeAttributeName;
199
- private _stateAttributeName;
200
- private _stateAfterAttributeName;
201
- private _stateBeforeAttributeValue;
202
- private _stateAttributeValueDoubleQuoted;
203
- private _stateAttributeValueSingleQuoted;
204
- private _stateAttributeValueUnquoted;
205
- private _stateAfterAttributeValueQuoted;
206
- private _stateSelfClosingStartTag;
207
- private _stateBogusComment;
208
- private _stateMarkupDeclarationOpen;
209
- private _stateCommentStart;
210
- private _stateCommentStartDash;
211
- private _stateComment;
212
- private _stateCommentLessThanSign;
213
- private _stateCommentLessThanSignBang;
214
- private _stateCommentLessThanSignBangDash;
215
- private _stateCommentLessThanSignBangDashDash;
216
- private _stateCommentEndDash;
217
- private _stateCommentEnd;
218
- private _stateCommentEndBang;
219
- private _stateDoctype;
220
- private _stateBeforeDoctypeName;
221
- private _stateDoctypeName;
222
- private _stateAfterDoctypeName;
223
- private _stateAfterDoctypePublicKeyword;
224
- private _stateBeforeDoctypePublicIdentifier;
225
- private _stateDoctypePublicIdentifierDoubleQuoted;
226
- private _stateDoctypePublicIdentifierSingleQuoted;
227
- private _stateAfterDoctypePublicIdentifier;
228
- private _stateBetweenDoctypePublicAndSystemIdentifiers;
229
- private _stateAfterDoctypeSystemKeyword;
230
- private _stateBeforeDoctypeSystemIdentifier;
231
- private _stateDoctypeSystemIdentifierDoubleQuoted;
232
- private _stateDoctypeSystemIdentifierSingleQuoted;
233
- private _stateAfterDoctypeSystemIdentifier;
234
- private _stateBogusDoctype;
235
- private _stateCdataSection;
236
- private _stateCdataSectionBracket;
237
- private _stateCdataSectionEnd;
238
- private _stateCharacterReference;
239
- private _stateNamedCharacterReference;
240
- private _stateAmbiguousAmpersand;
241
- private _stateNumericCharacterReference;
242
- private _stateHexademicalCharacterReferenceStart;
243
- private _stateHexademicalCharacterReference;
244
- private _stateDecimalCharacterReference;
245
- private _stateNumericCharacterReferenceEnd;
147
+ protected _ensureHibernation(): boolean;
148
+ protected _consume(): number;
149
+ protected _advanceBy(count: number): void;
150
+ protected _consumeSequenceIfMatch(pattern: string, caseSensitive: boolean): boolean;
151
+ protected _createStartTagToken(): void;
152
+ protected _createEndTagToken(): void;
153
+ protected _createCommentToken(offset: number): void;
154
+ protected _createDoctypeToken(initialName: string | null): void;
155
+ protected _createCharacterToken(type: CharacterToken['type'], chars: string): void;
156
+ protected _createAttr(attrNameFirstCh: string): void;
157
+ protected _leaveAttrName(): void;
158
+ protected _leaveAttrValue(): void;
159
+ protected prepareToken(ct: Token): void;
160
+ protected emitCurrentTagToken(): void;
161
+ protected emitCurrentComment(ct: CommentToken): void;
162
+ protected emitCurrentDoctype(ct: DoctypeToken): void;
163
+ protected _emitCurrentCharacterToken(nextLocation: Location | null): void;
164
+ protected _emitEOFToken(): void;
165
+ protected _appendCharToCurrentCharacterToken(type: CharacterToken['type'], ch: string): void;
166
+ protected _emitCodePoint(cp: number): void;
167
+ protected _emitChars(ch: string): void;
168
+ protected _startCharacterReference(): void;
169
+ protected _isCharacterReferenceInAttribute(): boolean;
170
+ protected _flushCodePointConsumedAsCharacterReference(cp: number): void;
171
+ protected _callState(cp: number): void;
172
+ protected _stateData(cp: number): void;
173
+ protected _stateRcdata(cp: number): void;
174
+ protected _stateRawtext(cp: number): void;
175
+ protected _stateScriptData(cp: number): void;
176
+ protected _statePlaintext(cp: number): void;
177
+ protected _stateTagOpen(cp: number): void;
178
+ protected _stateEndTagOpen(cp: number): void;
179
+ protected _stateTagName(cp: number): void;
180
+ protected _stateRcdataLessThanSign(cp: number): void;
181
+ protected _stateRcdataEndTagOpen(cp: number): void;
182
+ protected handleSpecialEndTag(_cp: number): boolean;
183
+ protected _stateRcdataEndTagName(cp: number): void;
184
+ protected _stateRawtextLessThanSign(cp: number): void;
185
+ protected _stateRawtextEndTagOpen(cp: number): void;
186
+ protected _stateRawtextEndTagName(cp: number): void;
187
+ protected _stateScriptDataLessThanSign(cp: number): void;
188
+ protected _stateScriptDataEndTagOpen(cp: number): void;
189
+ protected _stateScriptDataEndTagName(cp: number): void;
190
+ protected _stateScriptDataEscapeStart(cp: number): void;
191
+ protected _stateScriptDataEscapeStartDash(cp: number): void;
192
+ protected _stateScriptDataEscaped(cp: number): void;
193
+ protected _stateScriptDataEscapedDash(cp: number): void;
194
+ protected _stateScriptDataEscapedDashDash(cp: number): void;
195
+ protected _stateScriptDataEscapedLessThanSign(cp: number): void;
196
+ protected _stateScriptDataEscapedEndTagOpen(cp: number): void;
197
+ protected _stateScriptDataEscapedEndTagName(cp: number): void;
198
+ protected _stateScriptDataDoubleEscapeStart(cp: number): void;
199
+ protected _stateScriptDataDoubleEscaped(cp: number): void;
200
+ protected _stateScriptDataDoubleEscapedDash(cp: number): void;
201
+ protected _stateScriptDataDoubleEscapedDashDash(cp: number): void;
202
+ protected _stateScriptDataDoubleEscapedLessThanSign(cp: number): void;
203
+ protected _stateScriptDataDoubleEscapeEnd(cp: number): void;
204
+ protected _stateBeforeAttributeName(cp: number): void;
205
+ protected _stateAttributeName(cp: number): void;
206
+ protected _stateAfterAttributeName(cp: number): void;
207
+ protected _stateBeforeAttributeValue(cp: number): void;
208
+ protected _stateAttributeValueDoubleQuoted(cp: number): void;
209
+ protected _stateAttributeValueSingleQuoted(cp: number): void;
210
+ protected _stateAttributeValueUnquoted(cp: number): void;
211
+ protected _stateAfterAttributeValueQuoted(cp: number): void;
212
+ protected _stateSelfClosingStartTag(cp: number): void;
213
+ protected _stateBogusComment(cp: number): void;
214
+ protected _stateMarkupDeclarationOpen(cp: number): void;
215
+ protected _stateCommentStart(cp: number): void;
216
+ protected _stateCommentStartDash(cp: number): void;
217
+ protected _stateComment(cp: number): void;
218
+ protected _stateCommentLessThanSign(cp: number): void;
219
+ protected _stateCommentLessThanSignBang(cp: number): void;
220
+ protected _stateCommentLessThanSignBangDash(cp: number): void;
221
+ protected _stateCommentLessThanSignBangDashDash(cp: number): void;
222
+ protected _stateCommentEndDash(cp: number): void;
223
+ protected _stateCommentEnd(cp: number): void;
224
+ protected _stateCommentEndBang(cp: number): void;
225
+ protected _stateDoctype(cp: number): void;
226
+ protected _stateBeforeDoctypeName(cp: number): void;
227
+ protected _stateDoctypeName(cp: number): void;
228
+ protected _stateAfterDoctypeName(cp: number): void;
229
+ protected _stateAfterDoctypePublicKeyword(cp: number): void;
230
+ protected _stateBeforeDoctypePublicIdentifier(cp: number): void;
231
+ protected _stateDoctypePublicIdentifierDoubleQuoted(cp: number): void;
232
+ protected _stateDoctypePublicIdentifierSingleQuoted(cp: number): void;
233
+ protected _stateAfterDoctypePublicIdentifier(cp: number): void;
234
+ protected _stateBetweenDoctypePublicAndSystemIdentifiers(cp: number): void;
235
+ protected _stateAfterDoctypeSystemKeyword(cp: number): void;
236
+ protected _stateBeforeDoctypeSystemIdentifier(cp: number): void;
237
+ protected _stateDoctypeSystemIdentifierDoubleQuoted(cp: number): void;
238
+ protected _stateDoctypeSystemIdentifierSingleQuoted(cp: number): void;
239
+ protected _stateAfterDoctypeSystemIdentifier(cp: number): void;
240
+ protected _stateBogusDoctype(cp: number): void;
241
+ protected _stateCdataSection(cp: number): void;
242
+ protected _stateCdataSectionBracket(cp: number): void;
243
+ protected _stateCdataSectionEnd(cp: number): void;
244
+ protected _stateCharacterReference(): void;
245
+ protected _stateAmbiguousAmpersand(cp: number): void;
246
246
  }
247
247
  export {};
248
- //# sourceMappingURL=index.d.ts.map