File tree 3 files changed +80
-0
lines changed
3 files changed +80
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,15 @@ describe("Tokenizer", () => {
47
47
} ) ;
48
48
} ) ;
49
49
50
+ describe ( "should not break after special tag followed by an entity" , ( ) => {
51
+ it ( "for normal special tag" , ( ) => {
52
+ expect ( tokenize ( "<style>a{}</style>'<br/>" ) ) . toMatchSnapshot ( ) ;
53
+ } ) ;
54
+ it ( "for self-closing special tag" , ( ) => {
55
+ expect ( tokenize ( "<style />'<br/>" ) ) . toMatchSnapshot ( ) ;
56
+ } ) ;
57
+ } ) ;
58
+
50
59
it ( "should not lose data when pausing" , ( ) => {
51
60
const log : unknown [ ] [ ] = [ ] ;
52
61
const tokenizer = new Tokenizer (
Original file line number Diff line number Diff line change @@ -455,6 +455,7 @@ export default class Tokenizer {
455
455
// Skip everything until ">"
456
456
if ( c === CharCodes . Gt || this . fastForwardTo ( CharCodes . Gt ) ) {
457
457
this . state = State . Text ;
458
+ this . baseState = State . Text ;
458
459
this . sectionStart = this . index + 1 ;
459
460
}
460
461
}
Original file line number Diff line number Diff line change 1
1
// Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
3
+ exports [` Tokenizer should not break after special tag followed by an entity for normal special tag 1` ] = `
4
+ [
5
+ [
6
+ "onopentagname",
7
+ 1,
8
+ 6,
9
+ ],
10
+ [
11
+ "onopentagend",
12
+ 6,
13
+ ],
14
+ [
15
+ "ontext",
16
+ 7,
17
+ 10,
18
+ ],
19
+ [
20
+ "onclosetag",
21
+ 12,
22
+ 17,
23
+ ],
24
+ [
25
+ "ontextentity",
26
+ 39,
27
+ ],
28
+ [
29
+ "onopentagname",
30
+ 25,
31
+ 27,
32
+ ],
33
+ [
34
+ "onselfclosingtag",
35
+ 28,
36
+ ],
37
+ [
38
+ "onend",
39
+ ],
40
+ ]
41
+ ` ;
42
+
43
+ exports [` Tokenizer should not break after special tag followed by an entity for self-closing special tag 1` ] = `
44
+ [
45
+ [
46
+ "onopentagname",
47
+ 1,
48
+ 6,
49
+ ],
50
+ [
51
+ "onselfclosingtag",
52
+ 8,
53
+ ],
54
+ [
55
+ "ontextentity",
56
+ 39,
57
+ ],
58
+ [
59
+ "onopentagname",
60
+ 16,
61
+ 18,
62
+ ],
63
+ [
64
+ "onselfclosingtag",
65
+ 19,
66
+ ],
67
+ [
68
+ "onend",
69
+ ],
70
+ ]
71
+ ` ;
72
+
3
73
exports [` Tokenizer should not lose data when pausing 1` ] = `
4
74
[
5
75
[
You can’t perform that action at this time.
0 commit comments