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
@@ -60,26 +60,41 @@ const defaultParserOptions = {
60
60
  };
61
61
  //Parser
62
62
  class Parser {
63
- constructor(options, document, fragmentContext = null, scriptHandler = null) {
63
+ constructor(options, document,
64
+ /** @internal */
65
+ fragmentContext = null,
66
+ /** @internal */
67
+ scriptHandler = null) {
64
68
  this.fragmentContext = fragmentContext;
65
69
  this.scriptHandler = scriptHandler;
66
70
  this.currentToken = null;
67
71
  this.stopped = false;
72
+ /** @internal */
68
73
  this.insertionMode = InsertionMode.INITIAL;
74
+ /** @internal */
69
75
  this.originalInsertionMode = InsertionMode.INITIAL;
76
+ /** @internal */
70
77
  this.headElement = null;
78
+ /** @internal */
71
79
  this.formElement = null;
72
80
  /** Indicates that the current node is not an element in the HTML namespace */
73
81
  this.currentNotInHTML = false;
74
82
  /**
75
83
  * The template insertion mode stack is maintained from the left.
76
84
  * Ie. the topmost element will always have index 0.
85
+ *
86
+ * @internal
77
87
  */
78
88
  this.tmplInsertionModeStack = [];
89
+ /** @internal */
79
90
  this.pendingCharacterTokens = [];
91
+ /** @internal */
80
92
  this.hasNonWhitespacePendingCharacterToken = false;
93
+ /** @internal */
81
94
  this.framesetOk = true;
95
+ /** @internal */
82
96
  this.skipNextNewLine = false;
97
+ /** @internal */
83
98
  this.fosterParentingEnabled = false;
84
99
  this.options = Object.assign(Object.assign({}, defaultParserOptions), options);
85
100
  this.treeAdapter = this.options.treeAdapter;
@@ -127,6 +142,7 @@ class Parser {
127
142
  return fragment;
128
143
  }
129
144
  //Errors
145
+ /** @internal */
130
146
  _err(token, code, beforeToken) {
131
147
  var _a;
132
148
  if (!this.onParseError)
@@ -144,12 +160,14 @@ class Parser {
144
160
  this.onParseError(err);
145
161
  }
146
162
  //Stack events
163
+ /** @internal */
147
164
  onItemPush(node, tid, isTop) {
148
165
  var _a, _b;
149
166
  (_b = (_a = this.treeAdapter).onItemPush) === null || _b === void 0 ? void 0 : _b.call(_a, node);
150
167
  if (isTop && this.openElements.stackTop > 0)
151
168
  this._setContextModes(node, tid);
152
169
  }
170
+ /** @internal */
153
171
  onItemPop(node, isTop) {
154
172
  var _a, _b;
155
173
  if (this.options.sourceCodeLocationInfo) {
@@ -174,6 +192,7 @@ class Parser {
174
192
  this.currentNotInHTML = !isHTML;
175
193
  this.tokenizer.inForeignNode = !isHTML && !this._isIntegrationPoint(tid, current);
176
194
  }
195
+ /** @protected */
177
196
  _switchToTextParsing(currentToken, nextTokenizerState) {
178
197
  this._insertElement(currentToken, html_js_1.NS.HTML);
179
198
  this.tokenizer.state = nextTokenizerState;
@@ -186,11 +205,13 @@ class Parser {
186
205
  this.tokenizer.state = index_js_1.TokenizerMode.PLAINTEXT;
187
206
  }
188
207
  //Fragment parsing
208
+ /** @protected */
189
209
  _getAdjustedCurrentElement() {
190
210
  return this.openElements.stackTop === 0 && this.fragmentContext
191
211
  ? this.fragmentContext
192
212
  : this.openElements.current;
193
213
  }
214
+ /** @protected */
194
215
  _findFormInFragmentContext() {
195
216
  let node = this.fragmentContext;
196
217
  while (node) {
@@ -233,6 +254,7 @@ class Parser {
233
254
  }
234
255
  }
235
256
  //Tree mutation
257
+ /** @protected */
236
258
  _setDocumentType(token) {
237
259
  const name = token.name || '';
238
260
  const publicId = token.publicId || '';
@@ -246,6 +268,7 @@ class Parser {
246
268
  }
247
269
  }
248
270
  }
271
+ /** @protected */
249
272
  _attachElementToTree(element, location) {
250
273
  if (this.options.sourceCodeLocationInfo) {
251
274
  const loc = location && Object.assign(Object.assign({}, location), { startTag: location });
@@ -259,20 +282,28 @@ class Parser {
259
282
  this.treeAdapter.appendChild(parent, element);
260
283
  }
261
284
  }
285
+ /**
286
+ * For self-closing tags. Add an element to the tree, but skip adding it
287
+ * to the stack.
288
+ */
289
+ /** @protected */
262
290
  _appendElement(token, namespaceURI) {
263
291
  const element = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs);
264
292
  this._attachElementToTree(element, token.location);
265
293
  }
294
+ /** @protected */
266
295
  _insertElement(token, namespaceURI) {
267
296
  const element = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs);
268
297
  this._attachElementToTree(element, token.location);
269
298
  this.openElements.push(element, token.tagID);
270
299
  }
300
+ /** @protected */
271
301
  _insertFakeElement(tagName, tagID) {
272
302
  const element = this.treeAdapter.createElement(tagName, html_js_1.NS.HTML, []);
273
303
  this._attachElementToTree(element, null);
274
304
  this.openElements.push(element, tagID);
275
305
  }
306
+ /** @protected */
276
307
  _insertTemplate(token) {
277
308
  const tmpl = this.treeAdapter.createElement(token.tagName, html_js_1.NS.HTML, token.attrs);
278
309
  const content = this.treeAdapter.createDocumentFragment();
@@ -282,6 +313,7 @@ class Parser {
282
313
  if (this.options.sourceCodeLocationInfo)
283
314
  this.treeAdapter.setNodeSourceCodeLocation(content, null);
284
315
  }
316
+ /** @protected */
285
317
  _insertFakeRootElement() {
286
318
  const element = this.treeAdapter.createElement(html_js_1.TAG_NAMES.HTML, html_js_1.NS.HTML, []);
287
319
  if (this.options.sourceCodeLocationInfo)
@@ -289,6 +321,7 @@ class Parser {
289
321
  this.treeAdapter.appendChild(this.openElements.current, element);
290
322
  this.openElements.push(element, html_js_1.TAG_ID.HTML);
291
323
  }
324
+ /** @protected */
292
325
  _appendCommentNode(token, parent) {
293
326
  const commentNode = this.treeAdapter.createCommentNode(token.data);
294
327
  this.treeAdapter.appendChild(parent, commentNode);
@@ -296,6 +329,7 @@ class Parser {
296
329
  this.treeAdapter.setNodeSourceCodeLocation(commentNode, token.location);
297
330
  }
298
331
  }
332
+ /** @protected */
299
333
  _insertCharacters(token) {
300
334
  let parent;
301
335
  let beforeElement;
@@ -327,12 +361,14 @@ class Parser {
327
361
  this.treeAdapter.setNodeSourceCodeLocation(textNode, token.location);
328
362
  }
329
363
  }
364
+ /** @protected */
330
365
  _adoptNodes(donor, recipient) {
331
366
  for (let child = this.treeAdapter.getFirstChild(donor); child; child = this.treeAdapter.getFirstChild(donor)) {
332
367
  this.treeAdapter.detachNode(child);
333
368
  this.treeAdapter.appendChild(recipient, child);
334
369
  }
335
370
  }
371
+ /** @protected */
336
372
  _setEndLocation(element, closingToken) {
337
373
  if (this.treeAdapter.getNodeSourceCodeLocation(element) && closingToken.location) {
338
374
  const ctLoc = closingToken.location;
@@ -382,6 +418,7 @@ class Parser {
382
418
  ((token.tagID === html_js_1.TAG_ID.MGLYPH || token.tagID === html_js_1.TAG_ID.MALIGNMARK) &&
383
419
  !this._isIntegrationPoint(currentTagId, current, html_js_1.NS.HTML)));
384
420
  }
421
+ /** @protected */
385
422
  _processToken(token) {
386
423
  switch (token.type) {
387
424
  case token_js_1.TokenType.CHARACTER: {
@@ -419,12 +456,14 @@ class Parser {
419
456
  }
420
457
  }
421
458
  //Integration points
459
+ /** @protected */
422
460
  _isIntegrationPoint(tid, element, foreignNS) {
423
461
  const ns = this.treeAdapter.getNamespaceURI(element);
424
462
  const attrs = this.treeAdapter.getAttrList(element);
425
463
  return foreignContent.isIntegrationPoint(tid, ns, attrs, foreignNS);
426
464
  }
427
465
  //Active formatting elements reconstruction
466
+ /** @protected */
428
467
  _reconstructActiveFormattingElements() {
429
468
  const listLength = this.activeFormattingElements.entries.length;
430
469
  if (listLength) {
@@ -438,70 +477,86 @@ class Parser {
438
477
  }
439
478
  }
440
479
  //Close elements
480
+ /** @protected */
441
481
  _closeTableCell() {
442
482
  this.openElements.generateImpliedEndTags();
443
483
  this.openElements.popUntilTableCellPopped();
444
484
  this.activeFormattingElements.clearToLastMarker();
445
485
  this.insertionMode = InsertionMode.IN_ROW;
446
486
  }
487
+ /** @protected */
447
488
  _closePElement() {
448
489
  this.openElements.generateImpliedEndTagsWithExclusion(html_js_1.TAG_ID.P);
449
490
  this.openElements.popUntilTagNamePopped(html_js_1.TAG_ID.P);
450
491
  }
451
492
  //Insertion modes
493
+ /** @protected */
452
494
  _resetInsertionMode() {
453
495
  for (let i = this.openElements.stackTop; i >= 0; i--) {
454
496
  //Insertion mode reset map
455
497
  switch (i === 0 && this.fragmentContext ? this.fragmentContextID : this.openElements.tagIDs[i]) {
456
- case html_js_1.TAG_ID.TR:
498
+ case html_js_1.TAG_ID.TR: {
457
499
  this.insertionMode = InsertionMode.IN_ROW;
458
500
  return;
501
+ }
459
502
  case html_js_1.TAG_ID.TBODY:
460
503
  case html_js_1.TAG_ID.THEAD:
461
- case html_js_1.TAG_ID.TFOOT:
504
+ case html_js_1.TAG_ID.TFOOT: {
462
505
  this.insertionMode = InsertionMode.IN_TABLE_BODY;
463
506
  return;
464
- case html_js_1.TAG_ID.CAPTION:
507
+ }
508
+ case html_js_1.TAG_ID.CAPTION: {
465
509
  this.insertionMode = InsertionMode.IN_CAPTION;
466
510
  return;
467
- case html_js_1.TAG_ID.COLGROUP:
511
+ }
512
+ case html_js_1.TAG_ID.COLGROUP: {
468
513
  this.insertionMode = InsertionMode.IN_COLUMN_GROUP;
469
514
  return;
470
- case html_js_1.TAG_ID.TABLE:
515
+ }
516
+ case html_js_1.TAG_ID.TABLE: {
471
517
  this.insertionMode = InsertionMode.IN_TABLE;
472
518
  return;
473
- case html_js_1.TAG_ID.BODY:
519
+ }
520
+ case html_js_1.TAG_ID.BODY: {
474
521
  this.insertionMode = InsertionMode.IN_BODY;
475
522
  return;
476
- case html_js_1.TAG_ID.FRAMESET:
523
+ }
524
+ case html_js_1.TAG_ID.FRAMESET: {
477
525
  this.insertionMode = InsertionMode.IN_FRAMESET;
478
526
  return;
479
- case html_js_1.TAG_ID.SELECT:
527
+ }
528
+ case html_js_1.TAG_ID.SELECT: {
480
529
  this._resetInsertionModeForSelect(i);
481
530
  return;
482
- case html_js_1.TAG_ID.TEMPLATE:
531
+ }
532
+ case html_js_1.TAG_ID.TEMPLATE: {
483
533
  this.insertionMode = this.tmplInsertionModeStack[0];
484
534
  return;
485
- case html_js_1.TAG_ID.HTML:
535
+ }
536
+ case html_js_1.TAG_ID.HTML: {
486
537
  this.insertionMode = this.headElement ? InsertionMode.AFTER_HEAD : InsertionMode.BEFORE_HEAD;
487
538
  return;
539
+ }
488
540
  case html_js_1.TAG_ID.TD:
489
- case html_js_1.TAG_ID.TH:
541
+ case html_js_1.TAG_ID.TH: {
490
542
  if (i > 0) {
491
543
  this.insertionMode = InsertionMode.IN_CELL;
492
544
  return;
493
545
  }
494
546
  break;
495
- case html_js_1.TAG_ID.HEAD:
547
+ }
548
+ case html_js_1.TAG_ID.HEAD: {
496
549
  if (i > 0) {
497
550
  this.insertionMode = InsertionMode.IN_HEAD;
498
551
  return;
499
552
  }
500
553
  break;
554
+ }
501
555
  }
502
556
  }
503
557
  this.insertionMode = InsertionMode.IN_BODY;
504
558
  }
559
+ /** @protected */
505
560
  _resetInsertionModeForSelect(selectIdx) {
506
561
  if (selectIdx > 0) {
507
562
  for (let i = selectIdx - 1; i > 0; i--) {
@@ -518,21 +573,25 @@ class Parser {
518
573
  this.insertionMode = InsertionMode.IN_SELECT;
519
574
  }
520
575
  //Foster parenting
576
+ /** @protected */
521
577
  _isElementCausesFosterParenting(tn) {
522
578
  return TABLE_STRUCTURE_TAGS.has(tn);
523
579
  }
580
+ /** @protected */
524
581
  _shouldFosterParentOnInsertion() {
525
582
  return this.fosterParentingEnabled && this._isElementCausesFosterParenting(this.openElements.currentTagId);
526
583
  }
584
+ /** @protected */
527
585
  _findFosterParentingLocation() {
528
586
  for (let i = this.openElements.stackTop; i >= 0; i--) {
529
587
  const openElement = this.openElements.items[i];
530
588
  switch (this.openElements.tagIDs[i]) {
531
- case html_js_1.TAG_ID.TEMPLATE:
589
+ case html_js_1.TAG_ID.TEMPLATE: {
532
590
  if (this.treeAdapter.getNamespaceURI(openElement) === html_js_1.NS.HTML) {
533
591
  return { parent: this.treeAdapter.getTemplateContent(openElement), beforeElement: null };
534
592
  }
535
593
  break;
594
+ }
536
595
  case html_js_1.TAG_ID.TABLE: {
537
596
  const parent = this.treeAdapter.getParentNode(openElement);
538
597
  if (parent) {
@@ -546,6 +605,7 @@ class Parser {
546
605
  }
547
606
  return { parent: this.openElements.items[0], beforeElement: null };
548
607
  }
608
+ /** @protected */
549
609
  _fosterParentElement(element) {
550
610
  const location = this._findFosterParentingLocation();
551
611
  if (location.beforeElement) {
@@ -556,10 +616,12 @@ class Parser {
556
616
  }
557
617
  }
558
618
  //Special elements
619
+ /** @protected */
559
620
  _isSpecialElement(element, id) {
560
621
  const ns = this.treeAdapter.getNamespaceURI(element);
561
622
  return html_js_1.SPECIAL_ELEMENTS[ns].has(id);
562
623
  }
624
+ /** @internal */
563
625
  onCharacter(token) {
564
626
  this.skipNextNewLine = false;
565
627
  if (this.tokenizer.inForeignNode) {
@@ -567,56 +629,70 @@ class Parser {
567
629
  return;
568
630
  }
569
631
  switch (this.insertionMode) {
570
- case InsertionMode.INITIAL:
632
+ case InsertionMode.INITIAL: {
571
633
  tokenInInitialMode(this, token);
572
634
  break;
573
- case InsertionMode.BEFORE_HTML:
635
+ }
636
+ case InsertionMode.BEFORE_HTML: {
574
637
  tokenBeforeHtml(this, token);
575
638
  break;
576
- case InsertionMode.BEFORE_HEAD:
639
+ }
640
+ case InsertionMode.BEFORE_HEAD: {
577
641
  tokenBeforeHead(this, token);
578
642
  break;
579
- case InsertionMode.IN_HEAD:
643
+ }
644
+ case InsertionMode.IN_HEAD: {
580
645
  tokenInHead(this, token);
581
646
  break;
582
- case InsertionMode.IN_HEAD_NO_SCRIPT:
647
+ }
648
+ case InsertionMode.IN_HEAD_NO_SCRIPT: {
583
649
  tokenInHeadNoScript(this, token);
584
650
  break;
585
- case InsertionMode.AFTER_HEAD:
651
+ }
652
+ case InsertionMode.AFTER_HEAD: {
586
653
  tokenAfterHead(this, token);
587
654
  break;
655
+ }
588
656
  case InsertionMode.IN_BODY:
589
657
  case InsertionMode.IN_CAPTION:
590
658
  case InsertionMode.IN_CELL:
591
- case InsertionMode.IN_TEMPLATE:
659
+ case InsertionMode.IN_TEMPLATE: {
592
660
  characterInBody(this, token);
593
661
  break;
662
+ }
594
663
  case InsertionMode.TEXT:
595
664
  case InsertionMode.IN_SELECT:
596
- case InsertionMode.IN_SELECT_IN_TABLE:
665
+ case InsertionMode.IN_SELECT_IN_TABLE: {
597
666
  this._insertCharacters(token);
598
667
  break;
668
+ }
599
669
  case InsertionMode.IN_TABLE:
600
670
  case InsertionMode.IN_TABLE_BODY:
601
- case InsertionMode.IN_ROW:
671
+ case InsertionMode.IN_ROW: {
602
672
  characterInTable(this, token);
603
673
  break;
604
- case InsertionMode.IN_TABLE_TEXT:
674
+ }
675
+ case InsertionMode.IN_TABLE_TEXT: {
605
676
  characterInTableText(this, token);
606
677
  break;
607
- case InsertionMode.IN_COLUMN_GROUP:
678
+ }
679
+ case InsertionMode.IN_COLUMN_GROUP: {
608
680
  tokenInColumnGroup(this, token);
609
681
  break;
610
- case InsertionMode.AFTER_BODY:
682
+ }
683
+ case InsertionMode.AFTER_BODY: {
611
684
  tokenAfterBody(this, token);
612
685
  break;
613
- case InsertionMode.AFTER_AFTER_BODY:
686
+ }
687
+ case InsertionMode.AFTER_AFTER_BODY: {
614
688
  tokenAfterAfterBody(this, token);
615
689
  break;
690
+ }
616
691
  default:
617
692
  // Do nothing
618
693
  }
619
694
  }
695
+ /** @internal */
620
696
  onNullCharacter(token) {
621
697
  this.skipNextNewLine = false;
622
698
  if (this.tokenizer.inForeignNode) {
@@ -624,45 +700,57 @@ class Parser {
624
700
  return;
625
701
  }
626
702
  switch (this.insertionMode) {
627
- case InsertionMode.INITIAL:
703
+ case InsertionMode.INITIAL: {
628
704
  tokenInInitialMode(this, token);
629
705
  break;
630
- case InsertionMode.BEFORE_HTML:
706
+ }
707
+ case InsertionMode.BEFORE_HTML: {
631
708
  tokenBeforeHtml(this, token);
632
709
  break;
633
- case InsertionMode.BEFORE_HEAD:
710
+ }
711
+ case InsertionMode.BEFORE_HEAD: {
634
712
  tokenBeforeHead(this, token);
635
713
  break;
636
- case InsertionMode.IN_HEAD:
714
+ }
715
+ case InsertionMode.IN_HEAD: {
637
716
  tokenInHead(this, token);
638
717
  break;
639
- case InsertionMode.IN_HEAD_NO_SCRIPT:
718
+ }
719
+ case InsertionMode.IN_HEAD_NO_SCRIPT: {
640
720
  tokenInHeadNoScript(this, token);
641
721
  break;
642
- case InsertionMode.AFTER_HEAD:
722
+ }
723
+ case InsertionMode.AFTER_HEAD: {
643
724
  tokenAfterHead(this, token);
644
725
  break;
645
- case InsertionMode.TEXT:
726
+ }
727
+ case InsertionMode.TEXT: {
646
728
  this._insertCharacters(token);
647
729
  break;
730
+ }
648
731
  case InsertionMode.IN_TABLE:
649
732
  case InsertionMode.IN_TABLE_BODY:
650
- case InsertionMode.IN_ROW:
733
+ case InsertionMode.IN_ROW: {
651
734
  characterInTable(this, token);
652
735
  break;
653
- case InsertionMode.IN_COLUMN_GROUP:
736
+ }
737
+ case InsertionMode.IN_COLUMN_GROUP: {
654
738
  tokenInColumnGroup(this, token);
655
739
  break;
656
- case InsertionMode.AFTER_BODY:
740
+ }
741
+ case InsertionMode.AFTER_BODY: {
657
742
  tokenAfterBody(this, token);
658
743
  break;
659
- case InsertionMode.AFTER_AFTER_BODY:
744
+ }
745
+ case InsertionMode.AFTER_AFTER_BODY: {
660
746
  tokenAfterAfterBody(this, token);
661
747
  break;
748
+ }
662
749
  default:
663
750
  // Do nothing
664
751
  }
665
752
  }
753
+ /** @internal */
666
754
  onComment(token) {
667
755
  this.skipNextNewLine = false;
668
756
  if (this.currentNotInHTML) {
@@ -687,42 +775,51 @@ class Parser {
687
775
  case InsertionMode.IN_SELECT_IN_TABLE:
688
776
  case InsertionMode.IN_TEMPLATE:
689
777
  case InsertionMode.IN_FRAMESET:
690
- case InsertionMode.AFTER_FRAMESET:
778
+ case InsertionMode.AFTER_FRAMESET: {
691
779
  appendComment(this, token);
692
780
  break;
693
- case InsertionMode.IN_TABLE_TEXT:
781
+ }
782
+ case InsertionMode.IN_TABLE_TEXT: {
694
783
  tokenInTableText(this, token);
695
784
  break;
696
- case InsertionMode.AFTER_BODY:
785
+ }
786
+ case InsertionMode.AFTER_BODY: {
697
787
  appendCommentToRootHtmlElement(this, token);
698
788
  break;
789
+ }
699
790
  case InsertionMode.AFTER_AFTER_BODY:
700
- case InsertionMode.AFTER_AFTER_FRAMESET:
791
+ case InsertionMode.AFTER_AFTER_FRAMESET: {
701
792
  appendCommentToDocument(this, token);
702
793
  break;
794
+ }
703
795
  default:
704
796
  // Do nothing
705
797
  }
706
798
  }
799
+ /** @internal */
707
800
  onDoctype(token) {
708
801
  this.skipNextNewLine = false;
709
802
  switch (this.insertionMode) {
710
- case InsertionMode.INITIAL:
803
+ case InsertionMode.INITIAL: {
711
804
  doctypeInInitialMode(this, token);
712
805
  break;
806
+ }
713
807
  case InsertionMode.BEFORE_HEAD:
714
808
  case InsertionMode.IN_HEAD:
715
809
  case InsertionMode.IN_HEAD_NO_SCRIPT:
716
- case InsertionMode.AFTER_HEAD:
810
+ case InsertionMode.AFTER_HEAD: {
717
811
  this._err(token, error_codes_js_1.ERR.misplacedDoctype);
718
812
  break;
719
- case InsertionMode.IN_TABLE_TEXT:
813
+ }
814
+ case InsertionMode.IN_TABLE_TEXT: {
720
815
  tokenInTableText(this, token);
721
816
  break;
817
+ }
722
818
  default:
723
819
  // Do nothing
724
820
  }
725
821
  }
822
+ /** @internal */
726
823
  onStartTag(token) {
727
824
  this.skipNextNewLine = false;
728
825
  this.currentToken = token;
@@ -740,6 +837,7 @@ class Parser {
740
837
  * for nested calls.
741
838
  *
742
839
  * @param token The token to process.
840
+ * @protected
743
841
  */
744
842
  _processStartTag(token) {
745
843
  if (this.shouldProcessStartTagTokenInForeignContent(token)) {
@@ -749,78 +847,102 @@ class Parser {
749
847
  this._startTagOutsideForeignContent(token);
750
848
  }
751
849
  }
850
+ /** @protected */
752
851
  _startTagOutsideForeignContent(token) {
753
852
  switch (this.insertionMode) {
754
- case InsertionMode.INITIAL:
853
+ case InsertionMode.INITIAL: {
755
854
  tokenInInitialMode(this, token);
756
855
  break;
757
- case InsertionMode.BEFORE_HTML:
856
+ }
857
+ case InsertionMode.BEFORE_HTML: {
758
858
  startTagBeforeHtml(this, token);
759
859
  break;
760
- case InsertionMode.BEFORE_HEAD:
860
+ }
861
+ case InsertionMode.BEFORE_HEAD: {
761
862
  startTagBeforeHead(this, token);
762
863
  break;
763
- case InsertionMode.IN_HEAD:
864
+ }
865
+ case InsertionMode.IN_HEAD: {
764
866
  startTagInHead(this, token);
765
867
  break;
766
- case InsertionMode.IN_HEAD_NO_SCRIPT:
868
+ }
869
+ case InsertionMode.IN_HEAD_NO_SCRIPT: {
767
870
  startTagInHeadNoScript(this, token);
768
871
  break;
769
- case InsertionMode.AFTER_HEAD:
872
+ }
873
+ case InsertionMode.AFTER_HEAD: {
770
874
  startTagAfterHead(this, token);
771
875
  break;
772
- case InsertionMode.IN_BODY:
876
+ }
877
+ case InsertionMode.IN_BODY: {
773
878
  startTagInBody(this, token);
774
879
  break;
775
- case InsertionMode.IN_TABLE:
880
+ }
881
+ case InsertionMode.IN_TABLE: {
776
882
  startTagInTable(this, token);
777
883
  break;
778
- case InsertionMode.IN_TABLE_TEXT:
884
+ }
885
+ case InsertionMode.IN_TABLE_TEXT: {
779
886
  tokenInTableText(this, token);
780
887
  break;
781
- case InsertionMode.IN_CAPTION:
888
+ }
889
+ case InsertionMode.IN_CAPTION: {
782
890
  startTagInCaption(this, token);
783
891
  break;
784
- case InsertionMode.IN_COLUMN_GROUP:
892
+ }
893
+ case InsertionMode.IN_COLUMN_GROUP: {
785
894
  startTagInColumnGroup(this, token);
786
895
  break;
787
- case InsertionMode.IN_TABLE_BODY:
896
+ }
897
+ case InsertionMode.IN_TABLE_BODY: {
788
898
  startTagInTableBody(this, token);
789
899
  break;
790
- case InsertionMode.IN_ROW:
900
+ }
901
+ case InsertionMode.IN_ROW: {
791
902
  startTagInRow(this, token);
792
903
  break;
793
- case InsertionMode.IN_CELL:
904
+ }
905
+ case InsertionMode.IN_CELL: {
794
906
  startTagInCell(this, token);
795
907
  break;
796
- case InsertionMode.IN_SELECT:
908
+ }
909
+ case InsertionMode.IN_SELECT: {
797
910
  startTagInSelect(this, token);
798
911
  break;
799
- case InsertionMode.IN_SELECT_IN_TABLE:
912
+ }
913
+ case InsertionMode.IN_SELECT_IN_TABLE: {
800
914
  startTagInSelectInTable(this, token);
801
915
  break;
802
- case InsertionMode.IN_TEMPLATE:
916
+ }
917
+ case InsertionMode.IN_TEMPLATE: {
803
918
  startTagInTemplate(this, token);
804
919
  break;
805
- case InsertionMode.AFTER_BODY:
920
+ }
921
+ case InsertionMode.AFTER_BODY: {
806
922
  startTagAfterBody(this, token);
807
923
  break;
808
- case InsertionMode.IN_FRAMESET:
924
+ }
925
+ case InsertionMode.IN_FRAMESET: {
809
926
  startTagInFrameset(this, token);
810
927
  break;
811
- case InsertionMode.AFTER_FRAMESET:
928
+ }
929
+ case InsertionMode.AFTER_FRAMESET: {
812
930
  startTagAfterFrameset(this, token);
813
931
  break;
814
- case InsertionMode.AFTER_AFTER_BODY:
932
+ }
933
+ case InsertionMode.AFTER_AFTER_BODY: {
815
934
  startTagAfterAfterBody(this, token);
816
935
  break;
817
- case InsertionMode.AFTER_AFTER_FRAMESET:
936
+ }
937
+ case InsertionMode.AFTER_AFTER_FRAMESET: {
818
938
  startTagAfterAfterFrameset(this, token);
819
939
  break;
940
+ }
820
941
  default:
821
942
  // Do nothing
822
943
  }
823
944
  }
945
+ /** @internal */
824
946
  onEndTag(token) {
825
947
  this.skipNextNewLine = false;
826
948
  this.currentToken = token;
@@ -831,98 +953,128 @@ class Parser {
831
953
  this._endTagOutsideForeignContent(token);
832
954
  }
833
955
  }
956
+ /** @protected */
834
957
  _endTagOutsideForeignContent(token) {
835
958
  switch (this.insertionMode) {
836
- case InsertionMode.INITIAL:
959
+ case InsertionMode.INITIAL: {
837
960
  tokenInInitialMode(this, token);
838
961
  break;
839
- case InsertionMode.BEFORE_HTML:
962
+ }
963
+ case InsertionMode.BEFORE_HTML: {
840
964
  endTagBeforeHtml(this, token);
841
965
  break;
842
- case InsertionMode.BEFORE_HEAD:
966
+ }
967
+ case InsertionMode.BEFORE_HEAD: {
843
968
  endTagBeforeHead(this, token);
844
969
  break;
845
- case InsertionMode.IN_HEAD:
970
+ }
971
+ case InsertionMode.IN_HEAD: {
846
972
  endTagInHead(this, token);
847
973
  break;
848
- case InsertionMode.IN_HEAD_NO_SCRIPT:
974
+ }
975
+ case InsertionMode.IN_HEAD_NO_SCRIPT: {
849
976
  endTagInHeadNoScript(this, token);
850
977
  break;
851
- case InsertionMode.AFTER_HEAD:
978
+ }
979
+ case InsertionMode.AFTER_HEAD: {
852
980
  endTagAfterHead(this, token);
853
981
  break;
854
- case InsertionMode.IN_BODY:
982
+ }
983
+ case InsertionMode.IN_BODY: {
855
984
  endTagInBody(this, token);
856
985
  break;
857
- case InsertionMode.TEXT:
986
+ }
987
+ case InsertionMode.TEXT: {
858
988
  endTagInText(this, token);
859
989
  break;
860
- case InsertionMode.IN_TABLE:
990
+ }
991
+ case InsertionMode.IN_TABLE: {
861
992
  endTagInTable(this, token);
862
993
  break;
863
- case InsertionMode.IN_TABLE_TEXT:
994
+ }
995
+ case InsertionMode.IN_TABLE_TEXT: {
864
996
  tokenInTableText(this, token);
865
997
  break;
866
- case InsertionMode.IN_CAPTION:
998
+ }
999
+ case InsertionMode.IN_CAPTION: {
867
1000
  endTagInCaption(this, token);
868
1001
  break;
869
- case InsertionMode.IN_COLUMN_GROUP:
1002
+ }
1003
+ case InsertionMode.IN_COLUMN_GROUP: {
870
1004
  endTagInColumnGroup(this, token);
871
1005
  break;
872
- case InsertionMode.IN_TABLE_BODY:
1006
+ }
1007
+ case InsertionMode.IN_TABLE_BODY: {
873
1008
  endTagInTableBody(this, token);
874
1009
  break;
875
- case InsertionMode.IN_ROW:
1010
+ }
1011
+ case InsertionMode.IN_ROW: {
876
1012
  endTagInRow(this, token);
877
1013
  break;
878
- case InsertionMode.IN_CELL:
1014
+ }
1015
+ case InsertionMode.IN_CELL: {
879
1016
  endTagInCell(this, token);
880
1017
  break;
881
- case InsertionMode.IN_SELECT:
1018
+ }
1019
+ case InsertionMode.IN_SELECT: {
882
1020
  endTagInSelect(this, token);
883
1021
  break;
884
- case InsertionMode.IN_SELECT_IN_TABLE:
1022
+ }
1023
+ case InsertionMode.IN_SELECT_IN_TABLE: {
885
1024
  endTagInSelectInTable(this, token);
886
1025
  break;
887
- case InsertionMode.IN_TEMPLATE:
1026
+ }
1027
+ case InsertionMode.IN_TEMPLATE: {
888
1028
  endTagInTemplate(this, token);
889
1029
  break;
890
- case InsertionMode.AFTER_BODY:
1030
+ }
1031
+ case InsertionMode.AFTER_BODY: {
891
1032
  endTagAfterBody(this, token);
892
1033
  break;
893
- case InsertionMode.IN_FRAMESET:
1034
+ }
1035
+ case InsertionMode.IN_FRAMESET: {
894
1036
  endTagInFrameset(this, token);
895
1037
  break;
896
- case InsertionMode.AFTER_FRAMESET:
1038
+ }
1039
+ case InsertionMode.AFTER_FRAMESET: {
897
1040
  endTagAfterFrameset(this, token);
898
1041
  break;
899
- case InsertionMode.AFTER_AFTER_BODY:
1042
+ }
1043
+ case InsertionMode.AFTER_AFTER_BODY: {
900
1044
  tokenAfterAfterBody(this, token);
901
1045
  break;
1046
+ }
902
1047
  default:
903
1048
  // Do nothing
904
1049
  }
905
1050
  }
1051
+ /** @internal */
906
1052
  onEof(token) {
907
1053
  switch (this.insertionMode) {
908
- case InsertionMode.INITIAL:
1054
+ case InsertionMode.INITIAL: {
909
1055
  tokenInInitialMode(this, token);
910
1056
  break;
911
- case InsertionMode.BEFORE_HTML:
1057
+ }
1058
+ case InsertionMode.BEFORE_HTML: {
912
1059
  tokenBeforeHtml(this, token);
913
1060
  break;
914
- case InsertionMode.BEFORE_HEAD:
1061
+ }
1062
+ case InsertionMode.BEFORE_HEAD: {
915
1063
  tokenBeforeHead(this, token);
916
1064
  break;
917
- case InsertionMode.IN_HEAD:
1065
+ }
1066
+ case InsertionMode.IN_HEAD: {
918
1067
  tokenInHead(this, token);
919
1068
  break;
920
- case InsertionMode.IN_HEAD_NO_SCRIPT:
1069
+ }
1070
+ case InsertionMode.IN_HEAD_NO_SCRIPT: {
921
1071
  tokenInHeadNoScript(this, token);
922
1072
  break;
923
- case InsertionMode.AFTER_HEAD:
1073
+ }
1074
+ case InsertionMode.AFTER_HEAD: {
924
1075
  tokenAfterHead(this, token);
925
1076
  break;
1077
+ }
926
1078
  case InsertionMode.IN_BODY:
927
1079
  case InsertionMode.IN_TABLE:
928
1080
  case InsertionMode.IN_CAPTION:
@@ -931,29 +1083,35 @@ class Parser {
931
1083
  case InsertionMode.IN_ROW:
932
1084
  case InsertionMode.IN_CELL:
933
1085
  case InsertionMode.IN_SELECT:
934
- case InsertionMode.IN_SELECT_IN_TABLE:
1086
+ case InsertionMode.IN_SELECT_IN_TABLE: {
935
1087
  eofInBody(this, token);
936
1088
  break;
937
- case InsertionMode.TEXT:
1089
+ }
1090
+ case InsertionMode.TEXT: {
938
1091
  eofInText(this, token);
939
1092
  break;
940
- case InsertionMode.IN_TABLE_TEXT:
1093
+ }
1094
+ case InsertionMode.IN_TABLE_TEXT: {
941
1095
  tokenInTableText(this, token);
942
1096
  break;
943
- case InsertionMode.IN_TEMPLATE:
1097
+ }
1098
+ case InsertionMode.IN_TEMPLATE: {
944
1099
  eofInTemplate(this, token);
945
1100
  break;
1101
+ }
946
1102
  case InsertionMode.AFTER_BODY:
947
1103
  case InsertionMode.IN_FRAMESET:
948
1104
  case InsertionMode.AFTER_FRAMESET:
949
1105
  case InsertionMode.AFTER_AFTER_BODY:
950
- case InsertionMode.AFTER_AFTER_FRAMESET:
1106
+ case InsertionMode.AFTER_AFTER_FRAMESET: {
951
1107
  stopParsing(this, token);
952
1108
  break;
1109
+ }
953
1110
  default:
954
1111
  // Do nothing
955
1112
  }
956
1113
  }
1114
+ /** @internal */
957
1115
  onWhitespaceCharacter(token) {
958
1116
  if (this.skipNextNewLine) {
959
1117
  this.skipNextNewLine = false;
@@ -977,26 +1135,30 @@ class Parser {
977
1135
  case InsertionMode.IN_SELECT:
978
1136
  case InsertionMode.IN_SELECT_IN_TABLE:
979
1137
  case InsertionMode.IN_FRAMESET:
980
- case InsertionMode.AFTER_FRAMESET:
1138
+ case InsertionMode.AFTER_FRAMESET: {
981
1139
  this._insertCharacters(token);
982
1140
  break;
1141
+ }
983
1142
  case InsertionMode.IN_BODY:
984
1143
  case InsertionMode.IN_CAPTION:
985
1144
  case InsertionMode.IN_CELL:
986
1145
  case InsertionMode.IN_TEMPLATE:
987
1146
  case InsertionMode.AFTER_BODY:
988
1147
  case InsertionMode.AFTER_AFTER_BODY:
989
- case InsertionMode.AFTER_AFTER_FRAMESET:
1148
+ case InsertionMode.AFTER_AFTER_FRAMESET: {
990
1149
  whitespaceCharacterInBody(this, token);
991
1150
  break;
1151
+ }
992
1152
  case InsertionMode.IN_TABLE:
993
1153
  case InsertionMode.IN_TABLE_BODY:
994
- case InsertionMode.IN_ROW:
1154
+ case InsertionMode.IN_ROW: {
995
1155
  characterInTable(this, token);
996
1156
  break;
997
- case InsertionMode.IN_TABLE_TEXT:
1157
+ }
1158
+ case InsertionMode.IN_TABLE_TEXT: {
998
1159
  whitespaceCharacterInTableText(this, token);
999
1160
  break;
1161
+ }
1000
1162
  default:
1001
1163
  // Do nothing
1002
1164
  }
@@ -1523,7 +1685,7 @@ function numberedHeaderStartTagInBody(p, token) {
1523
1685
  if (p.openElements.hasInButtonScope(html_js_1.TAG_ID.P)) {
1524
1686
  p._closePElement();
1525
1687
  }
1526
- if ((0, html_js_1.isNumberedHeader)(p.openElements.currentTagId)) {
1688
+ if (html_js_1.NUMBERED_HEADERS.has(p.openElements.currentTagId)) {
1527
1689
  p.openElements.pop();
1528
1690
  }
1529
1691
  p._insertElement(token, html_js_1.NS.HTML);
@@ -1685,9 +1847,9 @@ function iframeStartTagInBody(p, token) {
1685
1847
  p.framesetOk = false;
1686
1848
  p._switchToTextParsing(token, index_js_1.TokenizerMode.RAWTEXT);
1687
1849
  }
1688
- //NOTE: here we assume that we always act as an user agent with enabled plugins, so we parse
1689
- //<noembed> as rawtext.
1690
- function noembedStartTagInBody(p, token) {
1850
+ //NOTE: here we assume that we always act as a user agent with enabled plugins/frames, so we parse
1851
+ //<noembed>/<noframes> as rawtext.
1852
+ function rawTextStartTagInBody(p, token) {
1691
1853
  p._switchToTextParsing(token, index_js_1.TokenizerMode.RAWTEXT);
1692
1854
  }
1693
1855
  function selectStartTagInBody(p, token) {
@@ -1799,6 +1961,7 @@ function startTagInBody(p, token) {
1799
1961
  case html_js_1.TAG_ID.DETAILS:
1800
1962
  case html_js_1.TAG_ID.ADDRESS:
1801
1963
  case html_js_1.TAG_ID.ARTICLE:
1964
+ case html_js_1.TAG_ID.SEARCH:
1802
1965
  case html_js_1.TAG_ID.SECTION:
1803
1966
  case html_js_1.TAG_ID.SUMMARY:
1804
1967
  case html_js_1.TAG_ID.FIELDSET:
@@ -1922,8 +2085,9 @@ function startTagInBody(p, token) {
1922
2085
  optgroupStartTagInBody(p, token);
1923
2086
  break;
1924
2087
  }
1925
- case html_js_1.TAG_ID.NOEMBED: {
1926
- noembedStartTagInBody(p, token);
2088
+ case html_js_1.TAG_ID.NOEMBED:
2089
+ case html_js_1.TAG_ID.NOFRAMES: {
2090
+ rawTextStartTagInBody(p, token);
1927
2091
  break;
1928
2092
  }
1929
2093
  case html_js_1.TAG_ID.FRAMESET: {
@@ -1936,7 +2100,7 @@ function startTagInBody(p, token) {
1936
2100
  }
1937
2101
  case html_js_1.TAG_ID.NOSCRIPT: {
1938
2102
  if (p.options.scriptingEnabled) {
1939
- noembedStartTagInBody(p, token);
2103
+ rawTextStartTagInBody(p, token);
1940
2104
  }
1941
2105
  else {
1942
2106
  genericStartTagInBody(p, token);
@@ -2108,6 +2272,7 @@ function endTagInBody(p, token) {
2108
2272
  case html_js_1.TAG_ID.ADDRESS:
2109
2273
  case html_js_1.TAG_ID.ARTICLE:
2110
2274
  case html_js_1.TAG_ID.DETAILS:
2275
+ case html_js_1.TAG_ID.SEARCH:
2111
2276
  case html_js_1.TAG_ID.SECTION:
2112
2277
  case html_js_1.TAG_ID.SUMMARY:
2113
2278
  case html_js_1.TAG_ID.LISTING:
@@ -2627,8 +2792,9 @@ function endTagInRow(p, token) {
2627
2792
  // Ignore end tag
2628
2793
  break;
2629
2794
  }
2630
- default:
2795
+ default: {
2631
2796
  endTagInTable(p, token);
2797
+ }
2632
2798
  }
2633
2799
  }
2634
2800
  // The "in cell" insertion mode
@@ -2707,6 +2873,17 @@ function startTagInSelect(p, token) {
2707
2873
  p._insertElement(token, html_js_1.NS.HTML);
2708
2874
  break;
2709
2875
  }
2876
+ case html_js_1.TAG_ID.HR: {
2877
+ if (p.openElements.currentTagId === html_js_1.TAG_ID.OPTION) {
2878
+ p.openElements.pop();
2879
+ }
2880
+ if (p.openElements.currentTagId === html_js_1.TAG_ID.OPTGROUP) {
2881
+ p.openElements.pop();
2882
+ }
2883
+ p._appendElement(token, html_js_1.NS.HTML);
2884
+ token.ackSelfClosing = true;
2885
+ break;
2886
+ }
2710
2887
  case html_js_1.TAG_ID.INPUT:
2711
2888
  case html_js_1.TAG_ID.KEYGEN:
2712
2889
  case html_js_1.TAG_ID.TEXTAREA:
@@ -2817,39 +2994,45 @@ function startTagInTemplate(p, token) {
2817
2994
  case html_js_1.TAG_ID.SCRIPT:
2818
2995
  case html_js_1.TAG_ID.STYLE:
2819
2996
  case html_js_1.TAG_ID.TEMPLATE:
2820
- case html_js_1.TAG_ID.TITLE:
2997
+ case html_js_1.TAG_ID.TITLE: {
2821
2998
  startTagInHead(p, token);
2822
2999
  break;
3000
+ }
2823
3001
  // Re-process the token in the appropriate mode
2824
3002
  case html_js_1.TAG_ID.CAPTION:
2825
3003
  case html_js_1.TAG_ID.COLGROUP:
2826
3004
  case html_js_1.TAG_ID.TBODY:
2827
3005
  case html_js_1.TAG_ID.TFOOT:
2828
- case html_js_1.TAG_ID.THEAD:
3006
+ case html_js_1.TAG_ID.THEAD: {
2829
3007
  p.tmplInsertionModeStack[0] = InsertionMode.IN_TABLE;
2830
3008
  p.insertionMode = InsertionMode.IN_TABLE;
2831
3009
  startTagInTable(p, token);
2832
3010
  break;
2833
- case html_js_1.TAG_ID.COL:
3011
+ }
3012
+ case html_js_1.TAG_ID.COL: {
2834
3013
  p.tmplInsertionModeStack[0] = InsertionMode.IN_COLUMN_GROUP;
2835
3014
  p.insertionMode = InsertionMode.IN_COLUMN_GROUP;
2836
3015
  startTagInColumnGroup(p, token);
2837
3016
  break;
2838
- case html_js_1.TAG_ID.TR:
3017
+ }
3018
+ case html_js_1.TAG_ID.TR: {
2839
3019
  p.tmplInsertionModeStack[0] = InsertionMode.IN_TABLE_BODY;
2840
3020
  p.insertionMode = InsertionMode.IN_TABLE_BODY;
2841
3021
  startTagInTableBody(p, token);
2842
3022
  break;
3023
+ }
2843
3024
  case html_js_1.TAG_ID.TD:
2844
- case html_js_1.TAG_ID.TH:
3025
+ case html_js_1.TAG_ID.TH: {
2845
3026
  p.tmplInsertionModeStack[0] = InsertionMode.IN_ROW;
2846
3027
  p.insertionMode = InsertionMode.IN_ROW;
2847
3028
  startTagInRow(p, token);
2848
3029
  break;
2849
- default:
3030
+ }
3031
+ default: {
2850
3032
  p.tmplInsertionModeStack[0] = InsertionMode.IN_BODY;
2851
3033
  p.insertionMode = InsertionMode.IN_BODY;
2852
3034
  startTagInBody(p, token);
3035
+ }
2853
3036
  }
2854
3037
  }
2855
3038
  function endTagInTemplate(p, token) {
@@ -3050,4 +3233,3 @@ function endTagInForeignContent(p, token) {
3050
3233
  }
3051
3234
  }
3052
3235
  }
3053
- //# sourceMappingURL=index.js.map