Repository navigation
Commit 89dceda
fix(parser): ignore foreign elements when resetting the insertion mode
"Reset the insertion mode appropriately" only matches HTML elements. An SVG or MathML element named `select`, `template`, `td`, … selected that mode, whose handlers then emptied the open-element stack or dropped the rest of the input (`<table><td><svg><select><desc><table></table><td>x` threw a `TypeError`). The loop now skips elements outside the HTML namespace. It reads the tag first and asks the tree adapter for the namespace only for the fifteen tags that can select a mode (a table indexed by tag ID), so every other element it passes still costs one read. The search below an open `select` for a `table` or `template` reads namespaces only for those two tags.
The test covers the foreign names that used to switch modes; the stack tests count one read per element passed, for a reset after a `select` and for one inside it.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>1 parent 0a61bd5 commit 89dceda
3 files changed
Lines changed: 92 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
59 | 87 | | |
60 | 88 | | |
61 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
35 | 56 | | |
36 | 57 | | |
37 | 58 | | |
| |||
738 | 759 | | |
739 | 760 | | |
740 | 761 | | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
741 | 772 | | |
742 | | - | |
| 773 | + | |
743 | 774 | | |
744 | 775 | | |
745 | 776 | | |
| |||
809 | 840 | | |
810 | 841 | | |
811 | 842 | | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
812 | 846 | | |
813 | 847 | | |
814 | | - | |
| 848 | + | |
| 849 | + | |
815 | 850 | | |
816 | 851 | | |
817 | 852 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
0 commit comments