Skip to content

Commit be63050

Browse files
committed
Fix: bugs about decimal character references
1 parent ff03a98 commit be63050

File tree

4 files changed

+338
-1
lines changed

4 files changed

+338
-1
lines changed

src/html/tokenizer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1650,7 +1650,7 @@ export class Tokenizer {
16501650
protected DECIMAL_CHARACTER_REFERENCE(cp: number): TokenizerState {
16511651
while (true) {
16521652
if (isDigit(cp)) {
1653-
this.crCode = 16 * this.crCode + (cp - 0x30)
1653+
this.crCode = 10 * this.crCode + (cp - 0x30)
16541654
}
16551655
else {
16561656
if (cp === SEMICOLON) {
Lines changed: 318 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,318 @@
1+
{
2+
"type": "Program",
3+
"start": 0,
4+
"end": 0,
5+
"loc": {
6+
"start": {
7+
"line": 1,
8+
"column": 0
9+
},
10+
"end": {
11+
"line": 1,
12+
"column": 0
13+
}
14+
},
15+
"range": [
16+
0,
17+
0
18+
],
19+
"body": [],
20+
"sourceType": "script",
21+
"comments": [],
22+
"tokens": [],
23+
"templateBody": {
24+
"type": "VElement",
25+
"range": [
26+
0,
27+
64
28+
],
29+
"loc": {
30+
"start": {
31+
"line": 1,
32+
"column": 0
33+
},
34+
"end": {
35+
"line": 5,
36+
"column": 11
37+
}
38+
},
39+
"name": "template",
40+
"namespace": "http://www.w3.org/1999/xhtml",
41+
"startTag": {
42+
"type": "VStartTag",
43+
"range": [
44+
0,
45+
10
46+
],
47+
"loc": {
48+
"start": {
49+
"line": 1,
50+
"column": 0
51+
},
52+
"end": {
53+
"line": 1,
54+
"column": 10
55+
}
56+
},
57+
"attributes": []
58+
},
59+
"children": [
60+
{
61+
"type": "VText",
62+
"range": [
63+
10,
64+
53
65+
],
66+
"loc": {
67+
"start": {
68+
"line": 1,
69+
"column": 10
70+
},
71+
"end": {
72+
"line": 5,
73+
"column": 0
74+
}
75+
},
76+
"value": "\n 👍\n 👍\n 👍\n"
77+
}
78+
],
79+
"endTag": {
80+
"type": "VEndTag",
81+
"range": [
82+
53,
83+
64
84+
],
85+
"loc": {
86+
"start": {
87+
"line": 5,
88+
"column": 0
89+
},
90+
"end": {
91+
"line": 5,
92+
"column": 11
93+
}
94+
}
95+
},
96+
"variables": [],
97+
"tokens": [
98+
{
99+
"type": "HTMLTagOpen",
100+
"range": [
101+
0,
102+
9
103+
],
104+
"loc": {
105+
"start": {
106+
"line": 1,
107+
"column": 0
108+
},
109+
"end": {
110+
"line": 1,
111+
"column": 9
112+
}
113+
},
114+
"value": "template"
115+
},
116+
{
117+
"type": "HTMLTagClose",
118+
"range": [
119+
9,
120+
10
121+
],
122+
"loc": {
123+
"start": {
124+
"line": 1,
125+
"column": 9
126+
},
127+
"end": {
128+
"line": 1,
129+
"column": 10
130+
}
131+
},
132+
"value": ""
133+
},
134+
{
135+
"type": "HTMLWhitespace",
136+
"range": [
137+
10,
138+
15
139+
],
140+
"loc": {
141+
"start": {
142+
"line": 1,
143+
"column": 10
144+
},
145+
"end": {
146+
"line": 2,
147+
"column": 4
148+
}
149+
},
150+
"value": "\n "
151+
},
152+
{
153+
"type": "HTMLText",
154+
"range": [
155+
15,
156+
24
157+
],
158+
"loc": {
159+
"start": {
160+
"line": 2,
161+
"column": 4
162+
},
163+
"end": {
164+
"line": 2,
165+
"column": 13
166+
}
167+
},
168+
"value": "👍"
169+
},
170+
{
171+
"type": "HTMLWhitespace",
172+
"range": [
173+
24,
174+
29
175+
],
176+
"loc": {
177+
"start": {
178+
"line": 2,
179+
"column": 13
180+
},
181+
"end": {
182+
"line": 3,
183+
"column": 4
184+
}
185+
},
186+
"value": "\n "
187+
},
188+
{
189+
"type": "HTMLText",
190+
"range": [
191+
29,
192+
38
193+
],
194+
"loc": {
195+
"start": {
196+
"line": 3,
197+
"column": 4
198+
},
199+
"end": {
200+
"line": 3,
201+
"column": 13
202+
}
203+
},
204+
"value": "👍"
205+
},
206+
{
207+
"type": "HTMLWhitespace",
208+
"range": [
209+
38,
210+
43
211+
],
212+
"loc": {
213+
"start": {
214+
"line": 3,
215+
"column": 13
216+
},
217+
"end": {
218+
"line": 4,
219+
"column": 4
220+
}
221+
},
222+
"value": "\n "
223+
},
224+
{
225+
"type": "HTMLText",
226+
"range": [
227+
43,
228+
52
229+
],
230+
"loc": {
231+
"start": {
232+
"line": 4,
233+
"column": 4
234+
},
235+
"end": {
236+
"line": 4,
237+
"column": 13
238+
}
239+
},
240+
"value": "👍"
241+
},
242+
{
243+
"type": "HTMLWhitespace",
244+
"range": [
245+
52,
246+
53
247+
],
248+
"loc": {
249+
"start": {
250+
"line": 4,
251+
"column": 13
252+
},
253+
"end": {
254+
"line": 5,
255+
"column": 0
256+
}
257+
},
258+
"value": "\n"
259+
},
260+
{
261+
"type": "HTMLEndTagOpen",
262+
"range": [
263+
53,
264+
63
265+
],
266+
"loc": {
267+
"start": {
268+
"line": 5,
269+
"column": 0
270+
},
271+
"end": {
272+
"line": 5,
273+
"column": 10
274+
}
275+
},
276+
"value": "template"
277+
},
278+
{
279+
"type": "HTMLTagClose",
280+
"range": [
281+
63,
282+
64
283+
],
284+
"loc": {
285+
"start": {
286+
"line": 5,
287+
"column": 10
288+
},
289+
"end": {
290+
"line": 5,
291+
"column": 11
292+
}
293+
},
294+
"value": ""
295+
},
296+
{
297+
"type": "HTMLWhitespace",
298+
"range": [
299+
64,
300+
65
301+
],
302+
"loc": {
303+
"start": {
304+
"line": 5,
305+
"column": 11
306+
},
307+
"end": {
308+
"line": 6,
309+
"column": 0
310+
}
311+
},
312+
"value": "\n"
313+
}
314+
],
315+
"comments": [],
316+
"errors": []
317+
}
318+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<template>
2+
&#128077;
3+
&#x1f44d;
4+
&#X1F44D;
5+
</template>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[
2+
"<template",
3+
">",
4+
"\n ",
5+
"&#128077;",
6+
"\n ",
7+
"&#x1f44d;",
8+
"\n ",
9+
"&#X1F44D;",
10+
"\n",
11+
"</template",
12+
">",
13+
"\n"
14+
]

0 commit comments

Comments
 (0)