diff --git a/crates/swc_html_parser/src/parser/mod.rs b/crates/swc_html_parser/src/parser/mod.rs index a0ecea75a217..d7f34e8b9c8e 100644 --- a/crates/swc_html_parser/src/parser/mod.rs +++ b/crates/swc_html_parser/src/parser/mod.rs @@ -533,12 +533,7 @@ where fn run(&mut self) -> PResult<()> { while !self.stopped { let adjusted_current_node = self.get_adjusted_current_node(); - let is_element_in_html_namespace = - if is_element_in_html_namespace(adjusted_current_node) { - true - } else { - is_html_integration_point(adjusted_current_node) - }; + let is_element_in_html_namespace = is_element_in_html_namespace(adjusted_current_node); self.input .set_adjusted_current_node_to_html_namespace(is_element_in_html_namespace); diff --git a/crates/swc_html_parser/tests/recovery/text/cdata/dom.rust-debug b/crates/swc_html_parser/tests/recovery/text/cdata/dom.rust-debug index 720ae91fb8e4..ff2b28dcb48b 100644 --- a/crates/swc_html_parser/tests/recovery/text/cdata/dom.rust-debug +++ b/crates/swc_html_parser/tests/recovery/text/cdata/dom.rust-debug @@ -63,16 +63,15 @@ | | height="100px" | width="100px" -| -| "a" +| "contenta" | " " | -| +| "content" | " " | -| +| "content" | " " | " diff --git a/crates/swc_html_parser/tests/recovery/text/cdata/output.json b/crates/swc_html_parser/tests/recovery/text/cdata/output.json index c330cfa42970..bd7b2e538c6d 100644 --- a/crates/swc_html_parser/tests/recovery/text/cdata/output.json +++ b/crates/swc_html_parser/tests/recovery/text/cdata/output.json @@ -577,25 +577,15 @@ } ], "children": [ - { - "type": "Comment", - "span": { - "start": 485, - "end": 504, - "ctxt": 0 - }, - "data": "[CDATA[content]]", - "raw": "content" - }, { "type": "Text", "span": { - "start": 504, + "start": 485, "end": 505, "ctxt": 0 }, - "data": "a", - "raw": "a" + "data": "contenta", + "raw": "contenta" } ], "content": null, @@ -623,14 +613,14 @@ "attributes": [], "children": [ { - "type": "Comment", + "type": "Text", "span": { "start": 532, - "end": 551, + "end": 548, "ctxt": 0 }, - "data": "[CDATA[content]]", - "raw": "content" + "data": "content", + "raw": "content" } ], "content": null, @@ -658,14 +648,14 @@ "attributes": [], "children": [ { - "type": "Comment", + "type": "Text", "span": { "start": 570, - "end": 589, + "end": 586, "ctxt": 0 }, - "data": "[CDATA[content]]", - "raw": "content" + "data": "content", + "raw": "content" } ], "content": null, diff --git a/crates/swc_html_parser/tests/recovery/text/cdata/output.stderr b/crates/swc_html_parser/tests/recovery/text/cdata/output.stderr index cbd42e5932fc..6dc864321d4d 100644 --- a/crates/swc_html_parser/tests/recovery/text/cdata/output.stderr +++ b/crates/swc_html_parser/tests/recovery/text/cdata/output.stderr @@ -86,27 +86,3 @@ : ^ 18 | `---- - - x Cdata in html content - ,-[$DIR/tests/recovery/text/cdata/input.html:18:1] - 18 | - 19 | contenta - : ^ - 20 | content - `---- - - x Cdata in html content - ,-[$DIR/tests/recovery/text/cdata/input.html:19:1] - 19 | contenta - 20 | content - : ^ - 21 | content - `---- - - x Cdata in html content - ,-[$DIR/tests/recovery/text/cdata/input.html:20:1] - 20 | content - 21 | content - : ^ - 22 | - `---- diff --git a/crates/swc_html_parser/tests/recovery/text/cdata/span.rust-debug b/crates/swc_html_parser/tests/recovery/text/cdata/span.rust-debug index ac089e56d085..d972198710ff 100644 --- a/crates/swc_html_parser/tests/recovery/text/cdata/span.rust-debug +++ b/crates/swc_html_parser/tests/recovery/text/cdata/span.rust-debug @@ -889,23 +889,7 @@ ,-[$DIR/tests/recovery/text/cdata/input.html:18:1] 18 | 19 | contenta - : ^^^^^^^^^^^^^^^^^^^ - 20 | content - `---- - - x Comment - ,-[$DIR/tests/recovery/text/cdata/input.html:18:1] - 18 | - 19 | contenta - : ^^^^^^^^^^^^^^^^^^^ - 20 | content - `---- - - x Child - ,-[$DIR/tests/recovery/text/cdata/input.html:18:1] - 18 | - 19 | contenta - : ^ + : ^^^^^^^^^^^^^^^^^^^^ 20 | content `---- @@ -913,7 +897,7 @@ ,-[$DIR/tests/recovery/text/cdata/input.html:18:1] 18 | 19 | contenta - : ^ + : ^^^^^^^^^^^^^^^^^^^^ 20 | content `---- @@ -953,15 +937,15 @@ ,-[$DIR/tests/recovery/text/cdata/input.html:19:1] 19 | contenta 20 | content - : ^^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^ 21 | content `---- - x Comment + x Text ,-[$DIR/tests/recovery/text/cdata/input.html:19:1] 19 | contenta 20 | content - : ^^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^ 21 | content `---- @@ -1001,15 +985,15 @@ ,-[$DIR/tests/recovery/text/cdata/input.html:20:1] 20 | content 21 | content - : ^^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^ 22 | `---- - x Comment + x Text ,-[$DIR/tests/recovery/text/cdata/input.html:20:1] 20 | content 21 | content - : ^^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^ 22 | `----