File tree Expand file tree Collapse file tree 3 files changed +80
-0
lines changed
Expand file tree Collapse file tree 3 files changed +80
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,15 @@ describe("Tokenizer", () => {
4747 } ) ;
4848 } ) ;
4949
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+
5059 it ( "should not lose data when pausing" , ( ) => {
5160 const log : unknown [ ] [ ] = [ ] ;
5261 const tokenizer = new Tokenizer (
Original file line number Diff line number Diff line change @@ -455,6 +455,7 @@ export default class Tokenizer {
455455 // Skip everything until ">"
456456 if ( c === CharCodes . Gt || this . fastForwardTo ( CharCodes . Gt ) ) {
457457 this . state = State . Text ;
458+ this . baseState = State . Text ;
458459 this . sectionStart = this . index + 1 ;
459460 }
460461 }
Original file line number Diff line number Diff line change 11// Jest Snapshot v1, https://goo.gl/fbAQLP
22
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+
373exports [` Tokenizer should not lose data when pausing 1` ] = `
474[
575 [
You can’t perform that action at this time.
0 commit comments