File tree Expand file tree Collapse file tree 8 files changed +55
-19
lines changed Expand file tree Collapse file tree 8 files changed +55
-19
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " htmljs-parser " : patch
3+ ---
4+
5+ Fix regression which caused script tags with a trailing comment as the same line as the closing tag to not always parse properly.
Original file line number Diff line number Diff line change 1+ ---
2+ " htmljs-parser " : patch
3+ ---
4+
5+ Remove unecessary check for cdata inside parsed text state.
Original file line number Diff line number Diff line change 1- 1╭─ <html-comment><![CDATA[[if lt IE 9]><div><![endif]]]></html-comment>
2- │ ││ ││ │ │ │ ╰─ closeTagEnd(html-comment)
3- │ ││ ││ │ │ ╰─ closeTagName "html-comment"
4- │ ││ ││ │ ╰─ closeTagStart "</"
5- │ ││ ││ ╰─ cdata.value "[if lt IE 9]><div><![endif]"
6- │ ││ │╰─ cdata "<![CDATA[[if lt IE 9]><div><![endif]]]>"
7- │ ││ ╰─ openTagEnd
8- │ │╰─ tagName "html-comment"
9- ╰─ ╰─ openTagStart
1+ 1╭─ <![CDATA[[if lt IE 9]><div><![endif]]]>
2+ │ │ ╰─ cdata.value "[if lt IE 9]><div><![endif]"
3+ ╰─ ╰─ cdata "<![CDATA[[if lt IE 9]><div><![endif]]]>"
Original file line number Diff line number Diff line change 1- <html-comment > < ![CDATA[[if lt IE 9]><div><![endif]]]> </html-comment >
1+ <![CDATA[[if lt IE 9]><div><![endif] ]]>
Original file line number Diff line number Diff line change 55 │ ││ │╰─ text "// this is a comment"
66 │ ││ ╰─ openTagEnd
77 │ │╰─ tagName "script"
8- ╰─ ╰─ openTagStart
8+ ╰─ ╰─ openTagStart
9+ 2├─
10+ 3╭─ <div>
11+ │ ││ ╰─ openTagEnd
12+ │ │╰─ tagName "div"
13+ ╰─ ╰─ openTagStart
14+ 4╭─ <script>// this is a comment</script>
15+ │ │ ││ ││ │ │ ╰─ closeTagEnd(script)
16+ │ │ ││ ││ │ ╰─ closeTagName "script"
17+ │ │ ││ ││ ╰─ closeTagStart "</"
18+ │ │ ││ │╰─ text "// this is a comment"
19+ │ │ ││ ╰─ openTagEnd
20+ │ │ │╰─ tagName "script"
21+ │ │ ╰─ openTagStart
22+ ╰─ ╰─ text "\n "
23+ 5╭─ <span>hi</span>
24+ │ │ ││ ││ │ │ ╰─ closeTagEnd(span)
25+ │ │ ││ ││ │ ╰─ closeTagName "span"
26+ │ │ ││ ││ ╰─ closeTagStart "</"
27+ │ │ ││ │╰─ text "hi"
28+ │ │ ││ ╰─ openTagEnd
29+ │ │ │╰─ tagName "span"
30+ │ │ ╰─ openTagStart
31+ ╰─ ╰─ text "\n "
32+ 6╭─ </div>
33+ │ │ │ ╰─ closeTagEnd(div)
34+ │ │ ╰─ closeTagName "div"
35+ │ ├─ text "\n"
36+ ╰─ ╰─ closeTagStart "</"
37+ 7╰─
Original file line number Diff line number Diff line change 1- <script >// this is a comment</script>
1+ <script >// this is a comment</script>
2+
3+ <div >
4+ <script >// this is a comment</script>
5+ <span >hi < / span >
6+ < / div >
Original file line number Diff line number Diff line change @@ -21,11 +21,12 @@ export const JS_COMMENT_LINE: StateDefinition = {
2121 if (
2222 ! this . isConcise &&
2323 code === CODE . OPEN_ANGLE_BRACKET &&
24- this . activeTag ?. type === TagType . text
24+ this . activeTag ?. type === TagType . text &&
25+ STATE . checkForClosingTag ( this )
2526 ) {
26- // First, see if we need to see if we reached the closing tag
27+ // We need to see if we reached the closing tag
2728 // eg: <script>//foo</script>
28- STATE . checkForClosingTag ( this ) ;
29+ this . exitState ( ) ;
2930 }
3031 } ,
3132
Original file line number Diff line number Diff line change @@ -29,10 +29,7 @@ export const PARSED_TEXT_CONTENT: StateDefinition<ParsedTextContentMeta> = {
2929 char ( code ) {
3030 switch ( code ) {
3131 case CODE . OPEN_ANGLE_BRACKET :
32- if (
33- this . isConcise ||
34- ! ( STATE . checkForClosingTag ( this ) || STATE . checkForCDATA ( this ) )
35- ) {
32+ if ( this . isConcise || ! STATE . checkForClosingTag ( this ) ) {
3633 this . startText ( ) ;
3734 }
3835 break ;
You can’t perform that action at this time.
0 commit comments