From e3cbe7e9a98149bfc05421a264d4e421fb543f7e Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Tue, 29 Nov 2022 05:39:48 +0300 Subject: [PATCH] fix(html/parser): Fix parsing of cdata (#6534) --- .../tests/fixture/cdata/input.html | 11 + .../tests/fixture/cdata/output.html | 11 + .../tests/fixture/cdata/output.min.html | 8 + crates/swc_html_parser/src/lexer/mod.rs | 60 +- crates/swc_html_parser/src/parser/mod.rs | 12 +- .../fixture/text/cdata-svg/dom.rust-debug | 112 ++ .../tests/fixture/text/cdata-svg/input.html | 32 + .../tests/fixture/text/cdata-svg/output.json | 1046 +++++++++++++ .../fixture/text/cdata-svg/span.rust-debug | 1364 +++++++++++++++++ .../recovery/comment/cdata-1/output.stderr | 4 +- .../tests/recovery/text/cdata/dom.rust-debug | 80 + .../tests/recovery/text/cdata/input.html | 24 + .../tests/recovery/text/cdata/output.json | 707 +++++++++ .../tests/recovery/text/cdata/output.stderr | 112 ++ .../tests/recovery/text/cdata/span.rust-debug | 1048 +++++++++++++ 15 files changed, 4592 insertions(+), 39 deletions(-) create mode 100644 crates/swc_html_codegen/tests/fixture/cdata/input.html create mode 100644 crates/swc_html_codegen/tests/fixture/cdata/output.html create mode 100644 crates/swc_html_codegen/tests/fixture/cdata/output.min.html create mode 100644 crates/swc_html_parser/tests/fixture/text/cdata-svg/dom.rust-debug create mode 100644 crates/swc_html_parser/tests/fixture/text/cdata-svg/input.html create mode 100644 crates/swc_html_parser/tests/fixture/text/cdata-svg/output.json create mode 100644 crates/swc_html_parser/tests/fixture/text/cdata-svg/span.rust-debug create mode 100644 crates/swc_html_parser/tests/recovery/text/cdata/dom.rust-debug create mode 100644 crates/swc_html_parser/tests/recovery/text/cdata/input.html create mode 100644 crates/swc_html_parser/tests/recovery/text/cdata/output.json create mode 100644 crates/swc_html_parser/tests/recovery/text/cdata/output.stderr create mode 100644 crates/swc_html_parser/tests/recovery/text/cdata/span.rust-debug diff --git a/crates/swc_html_codegen/tests/fixture/cdata/input.html b/crates/swc_html_codegen/tests/fixture/cdata/input.html new file mode 100644 index 00000000000..90d38e9e0d1 --- /dev/null +++ b/crates/swc_html_codegen/tests/fixture/cdata/input.html @@ -0,0 +1,11 @@ + + + + Document + + + + content + + + \ No newline at end of file diff --git a/crates/swc_html_codegen/tests/fixture/cdata/output.html b/crates/swc_html_codegen/tests/fixture/cdata/output.html new file mode 100644 index 00000000000..f486e5b11f2 --- /dev/null +++ b/crates/swc_html_codegen/tests/fixture/cdata/output.html @@ -0,0 +1,11 @@ + + + + Document + + + + content + + + \ No newline at end of file diff --git a/crates/swc_html_codegen/tests/fixture/cdata/output.min.html b/crates/swc_html_codegen/tests/fixture/cdata/output.min.html new file mode 100644 index 00000000000..9efcc442dca --- /dev/null +++ b/crates/swc_html_codegen/tests/fixture/cdata/output.min.html @@ -0,0 +1,8 @@ + + Document + + + + content + + diff --git a/crates/swc_html_parser/src/lexer/mod.rs b/crates/swc_html_parser/src/lexer/mod.rs index 05b1056260f..10542e943a1 100644 --- a/crates/swc_html_parser/src/lexer/mod.rs +++ b/crates/swc_html_parser/src/lexer/mod.rs @@ -134,8 +134,6 @@ struct Comment { pub(crate) type LexResult = Result; -// TODO improve `raw` for all tokens (linting + better codegen) - pub struct Lexer where I: Input, @@ -2682,37 +2680,35 @@ where // error. Create a comment token whose data is the "[CDATA[" string. // Switch to the bogus comment state. Some('[') => match self.consume_next_char() { - Some(c @ 'c' | c @ 'C') => match self.consume_next_char() { - Some(d @ 'd' | d @ 'D') => match self.consume_next_char() { - Some(a1 @ 'a' | a1 @ 'A') => match self.consume_next_char() { - Some(t @ 't' | t @ 'T') => match self.consume_next_char() { - Some(a2 @ 'a' | a2 @ 'A') => { - match self.consume_next_char() { - Some('[') => { - if let Some(false) = self.is_adjusted_current_node_is_element_in_html_namespace { - self.state = State::CdataSection; - } else { - self.emit_error( - ErrorKind::CdataInHtmlContent, - ); - let mut data = String::with_capacity(7); + Some(c @ 'C') => match self.consume_next_char() { + Some(d @ 'D') => match self.consume_next_char() { + Some(a1 @ 'A') => match self.consume_next_char() { + Some(t @ 'T') => match self.consume_next_char() { + Some(a2 @ 'A') => match self.consume_next_char() { + Some('[') => { + if let Some(false) = self.is_adjusted_current_node_is_element_in_html_namespace { + self.state = State::CdataSection; + } else { + self.emit_error( + ErrorKind::CdataInHtmlContent, + ); + let mut data = String::with_capacity(7); - data.push('['); - data.push(c); - data.push(d); - data.push(a1); - data.push(t); - data.push(a2); - data.push('['); + data.push('['); + data.push(c); + data.push(d); + data.push(a1); + data.push(t); + data.push(a2); + data.push('['); - self.create_comment_token(Some(data), " { - anything_else(self); + self.create_comment_token(Some(data), " { + anything_else(self); + } } _ => { anything_else(self); @@ -2725,15 +2721,15 @@ where _ => { anything_else(self); } - }, + } _ => { anything_else(self); } - }, + } _ => { anything_else(self); } - }, + } // Anything else // This is an incorrectly-opened-comment parse error. Create a comment token // whose data is the empty string. Switch to the bogus comment state (don't diff --git a/crates/swc_html_parser/src/parser/mod.rs b/crates/swc_html_parser/src/parser/mod.rs index ffc4ba8851b..a0ecea75a21 100644 --- a/crates/swc_html_parser/src/parser/mod.rs +++ b/crates/swc_html_parser/src/parser/mod.rs @@ -508,7 +508,7 @@ where } Data::Text { data, raw } => { let span = if let Some(end_span) = node.end_span.take() { - swc_common::Span::new(start_span.lo(), end_span.hi(), Default::default()) + Span::new(start_span.lo(), end_span.hi(), Default::default()) } else { start_span }; @@ -533,7 +533,12 @@ where fn run(&mut self) -> PResult<()> { while !self.stopped { let adjusted_current_node = self.get_adjusted_current_node(); - let is_element_in_html_namespace = is_element_in_html_namespace(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) + }; self.input .set_adjusted_current_node_to_html_namespace(is_element_in_html_namespace); @@ -625,9 +630,6 @@ where let is_mathml_annotation_xml = is_mathml_annotation_xml(adjusted_current_node); let is_html_integration_point = is_html_integration_point(adjusted_current_node); - self.input - .set_adjusted_current_node_to_html_namespace(is_element_in_html_namespace); - if self.open_elements_stack.items.is_empty() || is_element_in_html_namespace || (is_mathml_text_integration_point diff --git a/crates/swc_html_parser/tests/fixture/text/cdata-svg/dom.rust-debug b/crates/swc_html_parser/tests/fixture/text/cdata-svg/dom.rust-debug new file mode 100644 index 00000000000..9824d9be643 --- /dev/null +++ b/crates/swc_html_parser/tests/fixture/text/cdata-svg/dom.rust-debug @@ -0,0 +1,112 @@ +| +| +| lang="en-US" +| +| " + " +| +| charset="utf-8" +| " + " +| +| "SVG Demo" +| " + " +| <meta> +| content="width=device-width" +| name="viewport" +| " +" +| " +" +| <body> +| " +" +| <svg svg> +| viewBox="0 0 100 100" +| " + " +| <svg title> +| "A gradient" +| " + " +| <svg linearGradient> +| id="gradient" +| " + " +| <svg stop> +| class="begin" +| offset="0%" +| " + " +| <svg stop> +| class="end" +| offset="100%" +| " + " +| " + " +| <svg rect> +| height="100" +| style="fill:url(#gradient)" +| width="100" +| x="0" +| y="0" +| " + " +| <svg circle> +| cx="50" +| cy="50" +| r="30" +| style="fill:url(#gradient)" +| " + " +| <svg text> +| class="empty" +| " + " +| <svg text> +| "content" +| " + " +| <svg text> +| "&ing" +| " + " +| <svg text> +| "&ing ]" +| " + " +| <svg text> +| "&ing]] " +| " + " +| <svg text> +| "<message>text</message>" +| " + " +| <svg text> +| "</this is malformed!</malformed</malformed & worse>" +| " + " +| <svg text> +| "12" +| " + " +| <svg text> +| " + data + " +| " + " +| <svg text> +| "bracket ]after" +| " + " +| <svg text> +| "abracket ]afterb" +| " +" +| " + +" diff --git a/crates/swc_html_parser/tests/fixture/text/cdata-svg/input.html b/crates/swc_html_parser/tests/fixture/text/cdata-svg/input.html new file mode 100644 index 00000000000..67c48242d6e --- /dev/null +++ b/crates/swc_html_parser/tests/fixture/text/cdata-svg/input.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<html lang="en-US"> +<head> + <meta charset="utf-8" /> + <title>SVG Demo + + + + + A gradient + + + + + + + + content + &amping + &amping ] + &amping]] + <message>text</message> + </this is malformed!</malformed</malformed & worse> + 12 + + data + + bracket ]after + abracket ]afterb + + + \ No newline at end of file diff --git a/crates/swc_html_parser/tests/fixture/text/cdata-svg/output.json b/crates/swc_html_parser/tests/fixture/text/cdata-svg/output.json new file mode 100644 index 00000000000..daac3422e39 --- /dev/null +++ b/crates/swc_html_parser/tests/fixture/text/cdata-svg/output.json @@ -0,0 +1,1046 @@ +{ + "type": "Document", + "span": { + "start": 1, + "end": 1054, + "ctxt": 0 + }, + "mode": "no-quirks", + "children": [ + { + "type": "DocumentType", + "span": { + "start": 1, + "end": 16, + "ctxt": 0 + }, + "name": "html", + "publicId": null, + "systemId": null, + "raw": "" + }, + { + "type": "Element", + "span": { + "start": 17, + "end": 1054, + "ctxt": 0 + }, + "tagName": "html", + "namespace": "http://www.w3.org/1999/xhtml", + "attributes": [ + { + "type": "Attribute", + "span": { + "start": 23, + "end": 35, + "ctxt": 0 + }, + "namespace": null, + "prefix": null, + "name": "lang", + "rawName": "lang", + "value": "en-US", + "rawValue": "\"en-US\"" + } + ], + "children": [ + { + "type": "Element", + "span": { + "start": 37, + "end": 166, + "ctxt": 0 + }, + "tagName": "head", + "namespace": "http://www.w3.org/1999/xhtml", + "attributes": [], + "children": [ + { + "type": "Text", + "span": { + "start": 43, + "end": 48, + "ctxt": 0 + }, + "data": "\n ", + "raw": "\n " + }, + { + "type": "Element", + "span": { + "start": 48, + "end": 72, + "ctxt": 0 + }, + "tagName": "meta", + "namespace": "http://www.w3.org/1999/xhtml", + "attributes": [ + { + "type": "Attribute", + "span": { + "start": 54, + "end": 69, + "ctxt": 0 + }, + "namespace": null, + "prefix": null, + "name": "charset", + "rawName": "charset", + "value": "utf-8", + "rawValue": "\"utf-8\"" + } + ], + "children": [], + "content": null, + "isSelfClosing": true + }, + { + "type": "Text", + "span": { + "start": 72, + "end": 77, + "ctxt": 0 + }, + "data": "\n ", + "raw": "\n " + }, + { + "type": "Element", + "span": { + "start": 77, + "end": 100, + "ctxt": 0 + }, + "tagName": "title", + "namespace": "http://www.w3.org/1999/xhtml", + "attributes": [], + "children": [ + { + "type": "Text", + "span": { + "start": 84, + "end": 92, + "ctxt": 0 + }, + "data": "SVG Demo", + "raw": "SVG Demo" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 100, + "end": 105, + "ctxt": 0 + }, + "data": "\n ", + "raw": "\n " + }, + { + "type": "Element", + "span": { + "start": 105, + "end": 158, + "ctxt": 0 + }, + "tagName": "meta", + "namespace": "http://www.w3.org/1999/xhtml", + "attributes": [ + { + "type": "Attribute", + "span": { + "start": 111, + "end": 126, + "ctxt": 0 + }, + "namespace": null, + "prefix": null, + "name": "name", + "rawName": "name", + "value": "viewport", + "rawValue": "\"viewport\"" + }, + { + "type": "Attribute", + "span": { + "start": 127, + "end": 155, + "ctxt": 0 + }, + "namespace": null, + "prefix": null, + "name": "content", + "rawName": "content", + "value": "width=device-width", + "rawValue": "\"width=device-width\"" + } + ], + "children": [], + "content": null, + "isSelfClosing": true + }, + { + "type": "Text", + "span": { + "start": 158, + "end": 159, + "ctxt": 0 + }, + "data": "\n", + "raw": "\n" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 166, + "end": 167, + "ctxt": 0 + }, + "data": "\n", + "raw": "\n" + }, + { + "type": "Element", + "span": { + "start": 167, + "end": 1047, + "ctxt": 0 + }, + "tagName": "body", + "namespace": "http://www.w3.org/1999/xhtml", + "attributes": [], + "children": [ + { + "type": "Text", + "span": { + "start": 173, + "end": 174, + "ctxt": 0 + }, + "data": "\n", + "raw": "\n" + }, + { + "type": "Element", + "span": { + "start": 174, + "end": 1038, + "ctxt": 0 + }, + "tagName": "svg", + "namespace": "http://www.w3.org/2000/svg", + "attributes": [ + { + "type": "Attribute", + "span": { + "start": 179, + "end": 200, + "ctxt": 0 + }, + "namespace": null, + "prefix": null, + "name": "viewBox", + "rawName": "viewBox", + "value": "0 0 100 100", + "rawValue": "\"0 0 100 100\"" + } + ], + "children": [ + { + "type": "Text", + "span": { + "start": 201, + "end": 206, + "ctxt": 0 + }, + "data": "\n ", + "raw": "\n " + }, + { + "type": "Element", + "span": { + "start": 206, + "end": 231, + "ctxt": 0 + }, + "tagName": "title", + "namespace": "http://www.w3.org/2000/svg", + "attributes": [], + "children": [ + { + "type": "Text", + "span": { + "start": 213, + "end": 223, + "ctxt": 0 + }, + "data": "A gradient", + "raw": "A gradient" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 231, + "end": 236, + "ctxt": 0 + }, + "data": "\n ", + "raw": "\n " + }, + { + "type": "Element", + "span": { + "start": 236, + "end": 374, + "ctxt": 0 + }, + "tagName": "linearGradient", + "namespace": "http://www.w3.org/2000/svg", + "attributes": [ + { + "type": "Attribute", + "span": { + "start": 252, + "end": 265, + "ctxt": 0 + }, + "namespace": null, + "prefix": null, + "name": "id", + "rawName": "id", + "value": "gradient", + "rawValue": "\"gradient\"" + } + ], + "children": [ + { + "type": "Text", + "span": { + "start": 266, + "end": 275, + "ctxt": 0 + }, + "data": "\n ", + "raw": "\n " + }, + { + "type": "Element", + "span": { + "start": 275, + "end": 309, + "ctxt": 0 + }, + "tagName": "stop", + "namespace": "http://www.w3.org/2000/svg", + "attributes": [ + { + "type": "Attribute", + "span": { + "start": 281, + "end": 294, + "ctxt": 0 + }, + "namespace": null, + "prefix": null, + "name": "class", + "rawName": "class", + "value": "begin", + "rawValue": "\"begin\"" + }, + { + "type": "Attribute", + "span": { + "start": 295, + "end": 306, + "ctxt": 0 + }, + "namespace": null, + "prefix": null, + "name": "offset", + "rawName": "offset", + "value": "0%", + "rawValue": "\"0%\"" + } + ], + "children": [], + "content": null, + "isSelfClosing": true + }, + { + "type": "Text", + "span": { + "start": 309, + "end": 318, + "ctxt": 0 + }, + "data": "\n ", + "raw": "\n " + }, + { + "type": "Element", + "span": { + "start": 318, + "end": 352, + "ctxt": 0 + }, + "tagName": "stop", + "namespace": "http://www.w3.org/2000/svg", + "attributes": [ + { + "type": "Attribute", + "span": { + "start": 324, + "end": 335, + "ctxt": 0 + }, + "namespace": null, + "prefix": null, + "name": "class", + "rawName": "class", + "value": "end", + "rawValue": "\"end\"" + }, + { + "type": "Attribute", + "span": { + "start": 336, + "end": 349, + "ctxt": 0 + }, + "namespace": null, + "prefix": null, + "name": "offset", + "rawName": "offset", + "value": "100%", + "rawValue": "\"100%\"" + } + ], + "children": [], + "content": null, + "isSelfClosing": true + }, + { + "type": "Text", + "span": { + "start": 352, + "end": 357, + "ctxt": 0 + }, + "data": "\n ", + "raw": "\n " + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 374, + "end": 379, + "ctxt": 0 + }, + "data": "\n ", + "raw": "\n " + }, + { + "type": "Element", + "span": { + "start": 379, + "end": 452, + "ctxt": 0 + }, + "tagName": "rect", + "namespace": "http://www.w3.org/2000/svg", + "attributes": [ + { + "type": "Attribute", + "span": { + "start": 385, + "end": 390, + "ctxt": 0 + }, + "namespace": null, + "prefix": null, + "name": "x", + "rawName": "x", + "value": "0", + "rawValue": "\"0\"" + }, + { + "type": "Attribute", + "span": { + "start": 391, + "end": 396, + "ctxt": 0 + }, + "namespace": null, + "prefix": null, + "name": "y", + "rawName": "y", + "value": "0", + "rawValue": "\"0\"" + }, + { + "type": "Attribute", + "span": { + "start": 397, + "end": 408, + "ctxt": 0 + }, + "namespace": null, + "prefix": null, + "name": "width", + "rawName": "width", + "value": "100", + "rawValue": "\"100\"" + }, + { + "type": "Attribute", + "span": { + "start": 409, + "end": 421, + "ctxt": 0 + }, + "namespace": null, + "prefix": null, + "name": "height", + "rawName": "height", + "value": "100", + "rawValue": "\"100\"" + }, + { + "type": "Attribute", + "span": { + "start": 422, + "end": 449, + "ctxt": 0 + }, + "namespace": null, + "prefix": null, + "name": "style", + "rawName": "style", + "value": "fill:url(#gradient)", + "rawValue": "\"fill:url(#gradient)\"" + } + ], + "children": [], + "content": null, + "isSelfClosing": true + }, + { + "type": "Text", + "span": { + "start": 452, + "end": 457, + "ctxt": 0 + }, + "data": "\n ", + "raw": "\n " + }, + { + "type": "Element", + "span": { + "start": 457, + "end": 518, + "ctxt": 0 + }, + "tagName": "circle", + "namespace": "http://www.w3.org/2000/svg", + "attributes": [ + { + "type": "Attribute", + "span": { + "start": 465, + "end": 472, + "ctxt": 0 + }, + "namespace": null, + "prefix": null, + "name": "cx", + "rawName": "cx", + "value": "50", + "rawValue": "\"50\"" + }, + { + "type": "Attribute", + "span": { + "start": 473, + "end": 480, + "ctxt": 0 + }, + "namespace": null, + "prefix": null, + "name": "cy", + "rawName": "cy", + "value": "50", + "rawValue": "\"50\"" + }, + { + "type": "Attribute", + "span": { + "start": 481, + "end": 487, + "ctxt": 0 + }, + "namespace": null, + "prefix": null, + "name": "r", + "rawName": "r", + "value": "30", + "rawValue": "\"30\"" + }, + { + "type": "Attribute", + "span": { + "start": 488, + "end": 515, + "ctxt": 0 + }, + "namespace": null, + "prefix": null, + "name": "style", + "rawName": "style", + "value": "fill:url(#gradient)", + "rawValue": "\"fill:url(#gradient)\"" + } + ], + "children": [], + "content": null, + "isSelfClosing": true + }, + { + "type": "Text", + "span": { + "start": 518, + "end": 523, + "ctxt": 0 + }, + "data": "\n ", + "raw": "\n " + }, + { + "type": "Element", + "span": { + "start": 523, + "end": 562, + "ctxt": 0 + }, + "tagName": "text", + "namespace": "http://www.w3.org/2000/svg", + "attributes": [ + { + "type": "Attribute", + "span": { + "start": 529, + "end": 542, + "ctxt": 0 + }, + "namespace": null, + "prefix": null, + "name": "class", + "rawName": "class", + "value": "empty", + "rawValue": "\"empty\"" + } + ], + "children": [], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 562, + "end": 567, + "ctxt": 0 + }, + "data": "\n ", + "raw": "\n " + }, + { + "type": "Element", + "span": { + "start": 567, + "end": 599, + "ctxt": 0 + }, + "tagName": "text", + "namespace": "http://www.w3.org/2000/svg", + "attributes": [], + "children": [ + { + "type": "Text", + "span": { + "start": 573, + "end": 589, + "ctxt": 0 + }, + "data": "content", + "raw": "content" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 599, + "end": 604, + "ctxt": 0 + }, + "data": "\n ", + "raw": "\n " + }, + { + "type": "Element", + "span": { + "start": 604, + "end": 636, + "ctxt": 0 + }, + "tagName": "text", + "namespace": "http://www.w3.org/2000/svg", + "attributes": [], + "children": [ + { + "type": "Text", + "span": { + "start": 610, + "end": 626, + "ctxt": 0 + }, + "data": "&ing", + "raw": "&ing" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 636, + "end": 641, + "ctxt": 0 + }, + "data": "\n ", + "raw": "\n " + }, + { + "type": "Element", + "span": { + "start": 641, + "end": 675, + "ctxt": 0 + }, + "tagName": "text", + "namespace": "http://www.w3.org/2000/svg", + "attributes": [], + "children": [ + { + "type": "Text", + "span": { + "start": 647, + "end": 667, + "ctxt": 0 + }, + "data": "&ing ]", + "raw": "&ing ]" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 675, + "end": 680, + "ctxt": 0 + }, + "data": "\n ", + "raw": "\n " + }, + { + "type": "Element", + "span": { + "start": 680, + "end": 715, + "ctxt": 0 + }, + "tagName": "text", + "namespace": "http://www.w3.org/2000/svg", + "attributes": [], + "children": [ + { + "type": "Text", + "span": { + "start": 686, + "end": 705, + "ctxt": 0 + }, + "data": "&ing]] ", + "raw": "&ing]] " + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 715, + "end": 720, + "ctxt": 0 + }, + "data": "\n ", + "raw": "\n " + }, + { + "type": "Element", + "span": { + "start": 720, + "end": 768, + "ctxt": 0 + }, + "tagName": "text", + "namespace": "http://www.w3.org/2000/svg", + "attributes": [], + "children": [ + { + "type": "Text", + "span": { + "start": 726, + "end": 758, + "ctxt": 0 + }, + "data": "text", + "raw": "text" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 768, + "end": 773, + "ctxt": 0 + }, + "data": "\n ", + "raw": "\n " + }, + { + "type": "Element", + "span": { + "start": 773, + "end": 849, + "ctxt": 0 + }, + "tagName": "text", + "namespace": "http://www.w3.org/2000/svg", + "attributes": [], + "children": [ + { + "type": "Text", + "span": { + "start": 779, + "end": 839, + "ctxt": 0 + }, + "data": "", + "raw": "" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 849, + "end": 854, + "ctxt": 0 + }, + "data": "\n ", + "raw": "\n " + }, + { + "type": "Element", + "span": { + "start": 854, + "end": 893, + "ctxt": 0 + }, + "tagName": "text", + "namespace": "http://www.w3.org/2000/svg", + "attributes": [], + "children": [ + { + "type": "Text", + "span": { + "start": 860, + "end": 883, + "ctxt": 0 + }, + "data": "12", + "raw": "12" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 893, + "end": 898, + "ctxt": 0 + }, + "data": "\n ", + "raw": "\n " + }, + { + "type": "Element", + "span": { + "start": 898, + "end": 941, + "ctxt": 0 + }, + "tagName": "text", + "namespace": "http://www.w3.org/2000/svg", + "attributes": [], + "children": [ + { + "type": "Text", + "span": { + "start": 904, + "end": 934, + "ctxt": 0 + }, + "data": "\n data\n ", + "raw": "\n data\n " + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 941, + "end": 946, + "ctxt": 0 + }, + "data": "\n ", + "raw": "\n " + }, + { + "type": "Element", + "span": { + "start": 946, + "end": 985, + "ctxt": 0 + }, + "tagName": "text", + "namespace": "http://www.w3.org/2000/svg", + "attributes": [], + "children": [ + { + "type": "Text", + "span": { + "start": 952, + "end": 975, + "ctxt": 0 + }, + "data": "bracket ]after", + "raw": "bracket ]after" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 985, + "end": 990, + "ctxt": 0 + }, + "data": "\n ", + "raw": "\n " + }, + { + "type": "Element", + "span": { + "start": 990, + "end": 1031, + "ctxt": 0 + }, + "tagName": "text", + "namespace": "http://www.w3.org/2000/svg", + "attributes": [], + "children": [ + { + "type": "Text", + "span": { + "start": 996, + "end": 1024, + "ctxt": 0 + }, + "data": "abracket ]afterb", + "raw": "abracket ]afterb" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 1031, + "end": 1032, + "ctxt": 0 + }, + "data": "\n", + "raw": "\n" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 1038, + "end": 1047, + "ctxt": 0 + }, + "data": "\n\n", + "raw": "\n\n" + } + ], + "content": null, + "isSelfClosing": false + } + ], + "content": null, + "isSelfClosing": false + } + ] +} diff --git a/crates/swc_html_parser/tests/fixture/text/cdata-svg/span.rust-debug b/crates/swc_html_parser/tests/fixture/text/cdata-svg/span.rust-debug new file mode 100644 index 00000000000..3da4c90f4e5 --- /dev/null +++ b/crates/swc_html_parser/tests/fixture/text/cdata-svg/span.rust-debug @@ -0,0 +1,1364 @@ + + x Document + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:1:1] + 1 | ,-> + 2 | | + 3 | | + 4 | | + 5 | | SVG Demo + 6 | | + 7 | | + 8 | | + 9 | | + 10 | | A gradient + 11 | | + 12 | | + 13 | | + 14 | | + 15 | | + 16 | | + 17 | | + 18 | | content + 19 | | &amping + 20 | | &amping ] + 21 | | &amping]] + 22 | | <message>text</message> + 23 | | </this is malformed!</malformed</malformed & worse> + 24 | | 12 + 25 | | + 26 | | data + 27 | | + 28 | | bracket ]after + 29 | | abracket ]afterb + 30 | | + 31 | | + 32 | `-> + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:1:1] + 1 | + : ^^^^^^^^^^^^^^^ + 2 | + `---- + + x DocumentType + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:1:1] + 1 | + : ^^^^^^^^^^^^^^^ + 2 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:1:1] + 1 | + 2 | ,-> + 3 | | + 4 | | + 5 | | SVG Demo + 6 | | + 7 | | + 8 | | + 9 | | + 10 | | A gradient + 11 | | + 12 | | + 13 | | + 14 | | + 15 | | + 16 | | + 17 | | + 18 | | content + 19 | | &amping + 20 | | &amping ] + 21 | | &amping]] + 22 | | <message>text</message> + 23 | | </this is malformed!</malformed</malformed & worse> + 24 | | 12 + 25 | | + 26 | | data + 27 | | + 28 | | bracket ]after + 29 | | abracket ]afterb + 30 | | + 31 | | + 32 | `-> + `---- + + x Element + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:1:1] + 1 | + 2 | ,-> + 3 | | + 4 | | + 5 | | SVG Demo + 6 | | + 7 | | + 8 | | + 9 | | + 10 | | A gradient + 11 | | + 12 | | + 13 | | + 14 | | + 15 | | + 16 | | + 17 | | + 18 | | content + 19 | | &amping + 20 | | &amping ] + 21 | | &amping]] + 22 | | <message>text</message> + 23 | | </this is malformed!</malformed</malformed & worse> + 24 | | 12 + 25 | | + 26 | | data + 27 | | + 28 | | bracket ]after + 29 | | abracket ]afterb + 30 | | + 31 | | + 32 | `-> + `---- + + x Attribute + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:1:1] + 1 | + 2 | + : ^^^^^^^^^^^^ + 3 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:2:1] + 2 | + 3 | ,-> + 4 | | + 5 | | SVG Demo + 6 | | + 7 | `-> + 8 | + `---- + + x Element + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:2:1] + 2 | + 3 | ,-> + 4 | | + 5 | | SVG Demo + 6 | | + 7 | `-> + 8 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:2:1] + 2 | + 3 | ,-> + 4 | `-> + 5 | SVG Demo + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:2:1] + 2 | + 3 | ,-> + 4 | `-> + 5 | SVG Demo + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:3:1] + 3 | + 4 | + : ^^^^^^^^^^^^^^^^^^^^^^^^ + 5 | SVG Demo + `---- + + x Element + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:3:1] + 3 | + 4 | + : ^^^^^^^^^^^^^^^^^^^^^^^^ + 5 | SVG Demo + `---- + + x Attribute + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:3:1] + 3 | + 4 | + : ^^^^^^^^^^^^^^^ + 5 | SVG Demo + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:3:1] + 3 | + 4 | ,-> + 5 | `-> SVG Demo + 6 | + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:3:1] + 3 | + 4 | ,-> + 5 | `-> SVG Demo + 6 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:4:1] + 4 | + 5 | SVG Demo + : ^^^^^^^^^^^^^^^^^^^^^^^ + 6 | + `---- + + x Element + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:4:1] + 4 | + 5 | SVG Demo + : ^^^^^^^^^^^^^^^^^^^^^^^ + 6 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:4:1] + 4 | + 5 | SVG Demo + : ^^^^^^^^ + 6 | + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:4:1] + 4 | + 5 | SVG Demo + : ^^^^^^^^ + 6 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:4:1] + 4 | + 5 | ,-> SVG Demo + 6 | `-> + 7 | + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:4:1] + 4 | + 5 | ,-> SVG Demo + 6 | `-> + 7 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:5:1] + 5 | SVG Demo + 6 | + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 7 | + `---- + + x Element + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:5:1] + 5 | SVG Demo + 6 | + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 7 | + `---- + + x Attribute + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:5:1] + 5 | SVG Demo + 6 | + : ^^^^^^^^^^^^^^^ + 7 | + `---- + + x Attribute + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:5:1] + 5 | SVG Demo + 6 | + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 7 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:5:1] + 5 | SVG Demo + 6 | + : ^ + 7 | + 8 | + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:5:1] + 5 | SVG Demo + 6 | + : ^ + 7 | + 8 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:6:1] + 6 | + 7 | + : ^ + 8 | + 9 | + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:6:1] + 6 | + 7 | + : ^ + 8 | + 9 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:7:1] + 7 | + 8 | ,-> + 9 | | + 10 | | A gradient + 11 | | + 12 | | + 13 | | + 14 | | + 15 | | + 16 | | + 17 | | + 18 | | content + 19 | | &amping + 20 | | &amping ] + 21 | | &amping]] + 22 | | <message>text</message> + 23 | | </this is malformed!</malformed</malformed & worse> + 24 | | 12 + 25 | | + 26 | | data + 27 | | + 28 | | bracket ]after + 29 | | abracket ]afterb + 30 | | + 31 | `-> + 32 | + `---- + + x Element + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:7:1] + 7 | + 8 | ,-> + 9 | | + 10 | | A gradient + 11 | | + 12 | | + 13 | | + 14 | | + 15 | | + 16 | | + 17 | | + 18 | | content + 19 | | &amping + 20 | | &amping ] + 21 | | &amping]] + 22 | | <message>text</message> + 23 | | </this is malformed!</malformed</malformed & worse> + 24 | | 12 + 25 | | + 26 | | data + 27 | | + 28 | | bracket ]after + 29 | | abracket ]afterb + 30 | | + 31 | `-> + 32 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:7:1] + 7 | + 8 | + : ^ + 9 | + 10 | A gradient + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:7:1] + 7 | + 8 | + : ^ + 9 | + 10 | A gradient + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:8:1] + 8 | + 9 | ,-> + 10 | | A gradient + 11 | | + 12 | | + 13 | | + 14 | | + 15 | | + 16 | | + 17 | | + 18 | | content + 19 | | &amping + 20 | | &amping ] + 21 | | &amping]] + 22 | | <message>text</message> + 23 | | </this is malformed!</malformed</malformed & worse> + 24 | | 12 + 25 | | + 26 | | data + 27 | | + 28 | | bracket ]after + 29 | | abracket ]afterb + 30 | `-> + 31 | + `---- + + x Element + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:8:1] + 8 | + 9 | ,-> + 10 | | A gradient + 11 | | + 12 | | + 13 | | + 14 | | + 15 | | + 16 | | + 17 | | + 18 | | content + 19 | | &amping + 20 | | &amping ] + 21 | | &amping]] + 22 | | <message>text</message> + 23 | | </this is malformed!</malformed</malformed & worse> + 24 | | 12 + 25 | | + 26 | | data + 27 | | + 28 | | bracket ]after + 29 | | abracket ]afterb + 30 | `-> + 31 | + `---- + + x Attribute + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:8:1] + 8 | + 9 | + : ^^^^^^^^^^^^^^^^^^^^^ + 10 | A gradient + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:8:1] + 8 | + 9 | ,-> + 10 | `-> A gradient + 11 | + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:8:1] + 8 | + 9 | ,-> + 10 | `-> A gradient + 11 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:9:1] + 9 | + 10 | A gradient + : ^^^^^^^^^^^^^^^^^^^^^^^^^ + 11 | + `---- + + x Element + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:9:1] + 9 | + 10 | A gradient + : ^^^^^^^^^^^^^^^^^^^^^^^^^ + 11 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:9:1] + 9 | + 10 | A gradient + : ^^^^^^^^^^ + 11 | + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:9:1] + 9 | + 10 | A gradient + : ^^^^^^^^^^ + 11 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:9:1] + 9 | + 10 | ,-> A gradient + 11 | `-> + 12 | + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:9:1] + 9 | + 10 | ,-> A gradient + 11 | `-> + 12 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:10:1] + 10 | A gradient + 11 | ,-> + 12 | | + 13 | | + 14 | `-> + 15 | + `---- + + x Element + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:10:1] + 10 | A gradient + 11 | ,-> + 12 | | + 13 | | + 14 | `-> + 15 | + `---- + + x Attribute + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:10:1] + 10 | A gradient + 11 | + : ^^^^^^^^^^^^^ + 12 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:10:1] + 10 | A gradient + 11 | ,-> + 12 | `-> + 13 | + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:10:1] + 10 | A gradient + 11 | ,-> + 12 | `-> + 13 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:11:1] + 11 | + 12 | + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 13 | + `---- + + x Element + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:11:1] + 11 | + 12 | + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 13 | + `---- + + x Attribute + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:11:1] + 11 | + 12 | + : ^^^^^^^^^^^^^ + 13 | + `---- + + x Attribute + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:11:1] + 11 | + 12 | + : ^^^^^^^^^^^ + 13 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:11:1] + 11 | + 12 | ,-> + 13 | `-> + 14 | + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:11:1] + 11 | + 12 | ,-> + 13 | `-> + 14 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:12:1] + 12 | + 13 | + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 14 | + `---- + + x Element + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:12:1] + 12 | + 13 | + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 14 | + `---- + + x Attribute + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:12:1] + 12 | + 13 | + : ^^^^^^^^^^^ + 14 | + `---- + + x Attribute + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:12:1] + 12 | + 13 | + : ^^^^^^^^^^^^^ + 14 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:12:1] + 12 | + 13 | ,-> + 14 | `-> + 15 | + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:12:1] + 12 | + 13 | ,-> + 14 | `-> + 15 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:13:1] + 13 | + 14 | ,-> + 15 | `-> + 16 | + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:13:1] + 13 | + 14 | ,-> + 15 | `-> + 16 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:14:1] + 14 | + 15 | + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 16 | + `---- + + x Element + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:14:1] + 14 | + 15 | + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 16 | + `---- + + x Attribute + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:14:1] + 14 | + 15 | + : ^^^^^ + 16 | + `---- + + x Attribute + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:14:1] + 14 | + 15 | + : ^^^^^ + 16 | + `---- + + x Attribute + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:14:1] + 14 | + 15 | + : ^^^^^^^^^^^ + 16 | + `---- + + x Attribute + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:14:1] + 14 | + 15 | + : ^^^^^^^^^^^^ + 16 | + `---- + + x Attribute + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:14:1] + 14 | + 15 | + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 16 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:14:1] + 14 | + 15 | ,-> + 16 | `-> + 17 | + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:14:1] + 14 | + 15 | ,-> + 16 | `-> + 17 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:15:1] + 15 | + 16 | + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 17 | + `---- + + x Element + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:15:1] + 15 | + 16 | + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 17 | + `---- + + x Attribute + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:15:1] + 15 | + 16 | + : ^^^^^^^ + 17 | + `---- + + x Attribute + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:15:1] + 15 | + 16 | + : ^^^^^^^ + 17 | + `---- + + x Attribute + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:15:1] + 15 | + 16 | + : ^^^^^^ + 17 | + `---- + + x Attribute + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:15:1] + 15 | + 16 | + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 17 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:15:1] + 15 | + 16 | ,-> + 17 | `-> + 18 | content + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:15:1] + 15 | + 16 | ,-> + 17 | `-> + 18 | content + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:16:1] + 16 | + 17 | + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 18 | content + `---- + + x Element + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:16:1] + 16 | + 17 | + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 18 | content + `---- + + x Attribute + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:16:1] + 16 | + 17 | + : ^^^^^^^^^^^^^ + 18 | content + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:16:1] + 16 | + 17 | ,-> + 18 | `-> content + 19 | &amping + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:16:1] + 16 | + 17 | ,-> + 18 | `-> content + 19 | &amping + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:17:1] + 17 | + 18 | content + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 19 | &amping + `---- + + x Element + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:17:1] + 17 | + 18 | content + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 19 | &amping + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:17:1] + 17 | + 18 | content + : ^^^^^^^^^^^^^^^^ + 19 | &amping + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:17:1] + 17 | + 18 | content + : ^^^^^^^^^^^^^^^^ + 19 | &amping + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:17:1] + 17 | + 18 | ,-> content + 19 | `-> &amping + 20 | &amping ] + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:17:1] + 17 | + 18 | ,-> content + 19 | `-> &amping + 20 | &amping ] + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:18:1] + 18 | content + 19 | &amping + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 20 | &amping ] + `---- + + x Element + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:18:1] + 18 | content + 19 | &amping + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 20 | &amping ] + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:18:1] + 18 | content + 19 | &amping + : ^^^^^^^^^^^^^^^^ + 20 | &amping ] + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:18:1] + 18 | content + 19 | &amping + : ^^^^^^^^^^^^^^^^ + 20 | &amping ] + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:18:1] + 18 | content + 19 | ,-> &amping + 20 | `-> &amping ] + 21 | &amping]] + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:18:1] + 18 | content + 19 | ,-> &amping + 20 | `-> &amping ] + 21 | &amping]] + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:19:1] + 19 | &amping + 20 | &amping ] + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 21 | &amping]] + `---- + + x Element + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:19:1] + 19 | &amping + 20 | &amping ] + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 21 | &amping]] + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:19:1] + 19 | &amping + 20 | &amping ] + : ^^^^^^^^^^^^^^^^^^^^ + 21 | &amping]] + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:19:1] + 19 | &amping + 20 | &amping ] + : ^^^^^^^^^^^^^^^^^^^^ + 21 | &amping]] + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:19:1] + 19 | &amping + 20 | ,-> &amping ] + 21 | `-> &amping]] + 22 | <message>text</message> + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:19:1] + 19 | &amping + 20 | ,-> &amping ] + 21 | `-> &amping]] + 22 | <message>text</message> + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:20:1] + 20 | &amping ] + 21 | &amping]] + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 22 | <message>text</message> + `---- + + x Element + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:20:1] + 20 | &amping ] + 21 | &amping]] + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 22 | <message>text</message> + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:20:1] + 20 | &amping ] + 21 | &amping]] + : ^^^^^^^^^^^^^^^^^^^ + 22 | <message>text</message> + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:20:1] + 20 | &amping ] + 21 | &amping]] + : ^^^^^^^^^^^^^^^^^^^ + 22 | <message>text</message> + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:20:1] + 20 | &amping ] + 21 | ,-> &amping]] + 22 | `-> <message>text</message> + 23 | </this is malformed!</malformed</malformed & worse> + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:20:1] + 20 | &amping ] + 21 | ,-> &amping]] + 22 | `-> <message>text</message> + 23 | </this is malformed!</malformed</malformed & worse> + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:21:1] + 21 | &amping]] + 22 | <message>text</message> + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 23 | </this is malformed!</malformed</malformed & worse> + `---- + + x Element + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:21:1] + 21 | &amping]] + 22 | <message>text</message> + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 23 | </this is malformed!</malformed</malformed & worse> + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:21:1] + 21 | &amping]] + 22 | <message>text</message> + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 23 | </this is malformed!</malformed</malformed & worse> + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:21:1] + 21 | &amping]] + 22 | <message>text</message> + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 23 | </this is malformed!</malformed</malformed & worse> + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:21:1] + 21 | &amping]] + 22 | ,-> <message>text</message> + 23 | `-> </this is malformed!</malformed</malformed & worse> + 24 | 12 + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:21:1] + 21 | &amping]] + 22 | ,-> <message>text</message> + 23 | `-> </this is malformed!</malformed</malformed & worse> + 24 | 12 + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:22:1] + 22 | <message>text</message> + 23 | </this is malformed!</malformed</malformed & worse> + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 24 | 12 + `---- + + x Element + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:22:1] + 22 | <message>text</message> + 23 | </this is malformed!</malformed</malformed & worse> + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 24 | 12 + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:22:1] + 22 | <message>text</message> + 23 | </this is malformed!</malformed</malformed & worse> + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 24 | 12 + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:22:1] + 22 | <message>text</message> + 23 | </this is malformed!</malformed</malformed & worse> + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 24 | 12 + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:22:1] + 22 | <message>text</message> + 23 | ,-> </this is malformed!</malformed</malformed & worse> + 24 | `-> 12 + 25 | + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:22:1] + 22 | <message>text</message> + 23 | ,-> </this is malformed!</malformed</malformed & worse> + 24 | `-> 12 + 25 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:23:1] + 23 | </this is malformed!</malformed</malformed & worse> + 24 | 12 + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 25 | + `---- + + x Element + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:23:1] + 23 | </this is malformed!</malformed</malformed & worse> + 24 | 12 + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 25 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:23:1] + 23 | </this is malformed!</malformed</malformed & worse> + 24 | 12 + : ^^^^^^^^^^^^^^^^^^^^^^^ + 25 | + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:23:1] + 23 | </this is malformed!</malformed</malformed & worse> + 24 | 12 + : ^^^^^^^^^^^^^^^^^^^^^^^ + 25 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:23:1] + 23 | </this is malformed!</malformed</malformed & worse> + 24 | ,-> 12 + 25 | `-> + 26 | data + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:23:1] + 23 | </this is malformed!</malformed</malformed & worse> + 24 | ,-> 12 + 25 | `-> + 26 | data + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:24:1] + 24 | 12 + 25 | ,-> + 26 | | data + 27 | `-> + 28 | bracket ]after + `---- + + x Element + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:24:1] + 24 | 12 + 25 | ,-> + 26 | | data + 27 | `-> + 28 | bracket ]after + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:24:1] + 24 | 12 + 25 | ,-> + 26 | | data + 27 | `-> + 28 | bracket ]after + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:24:1] + 24 | 12 + 25 | ,-> + 26 | | data + 27 | `-> + 28 | bracket ]after + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:26:1] + 26 | data + 27 | ,-> + 28 | `-> bracket ]after + 29 | abracket ]afterb + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:26:1] + 26 | data + 27 | ,-> + 28 | `-> bracket ]after + 29 | abracket ]afterb + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:27:1] + 27 | + 28 | bracket ]after + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 29 | abracket ]afterb + `---- + + x Element + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:27:1] + 27 | + 28 | bracket ]after + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 29 | abracket ]afterb + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:27:1] + 27 | + 28 | bracket ]after + : ^^^^^^^^^^^^^^^^^^^^^^^ + 29 | abracket ]afterb + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:27:1] + 27 | + 28 | bracket ]after + : ^^^^^^^^^^^^^^^^^^^^^^^ + 29 | abracket ]afterb + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:27:1] + 27 | + 28 | ,-> bracket ]after + 29 | `-> abracket ]afterb + 30 | + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:27:1] + 27 | + 28 | ,-> + 29 | `-> ab + 30 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:28:1] + 28 | + 29 | ab + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 30 | + `---- + + x Element + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:28:1] + 28 | + 29 | ab + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 30 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:28:1] + 28 | + 29 | ab + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 30 | + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:28:1] + 28 | + 29 | ab + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 30 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:28:1] + 28 | + 29 | ab + : ^ + 30 | + 31 | + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:28:1] + 28 | + 29 | ab + : ^ + 30 | + 31 | + `---- + + x Child + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:29:1] + 29 | ab + 30 | ,-> + 31 | `-> + 32 | + `---- + + x Text + ,-[$DIR/tests/fixture/text/cdata-svg/input.html:29:1] + 29 | ab + 30 | ,-> + 31 | `-> + 32 | + `---- diff --git a/crates/swc_html_parser/tests/recovery/comment/cdata-1/output.stderr b/crates/swc_html_parser/tests/recovery/comment/cdata-1/output.stderr index 6f6c4a5e1c7..f77999c44ba 100644 --- a/crates/swc_html_parser/tests/recovery/comment/cdata-1/output.stderr +++ b/crates/swc_html_parser/tests/recovery/comment/cdata-1/output.stderr @@ -14,10 +14,10 @@ 10 | test 10 | +| +| lang="en" +| +| " + " +| +| "Document" +| " +" +| " +" +| <body> +| " +" +| <p> +| <!-- [CDATA[content]] --> +| " +" +| <p> +| <!-- [CDATA[&ing]] --> +| " +" +| <p> +| <!-- [CDATA[&ing ]]] --> +| " +" +| <p> +| <!-- [CDATA[&ing]] ]] --> +| " +" +| <p> +| <!-- [CDATA[<message --> +| "text]]>" +| " +" +| <p> +| <!-- [CDATA[</this is malformed!</malformed</malformed & worse --> +| "]]>" +| " +" +| <p> +| <!-- [CDATA[1]] --> +| <!-- [CDATA[2]] --> +| " +" +| <p> +| " + " +| <!-- [CDATA[data]] --> +| " +" +| " +" +| <p> +| <!-- [CDATA[bracket ]after]] --> +| " +" +| <svg svg> +| viewBox="0 0 100 100" +| " + " +| <svg foreignObject> +| height="100px" +| width="100px" +| <!-- [CDATA[content]] --> +| "a" +| " + " +| <svg desc> +| <!-- [CDATA[content]] --> +| " + " +| <svg title> +| <!-- [CDATA[content]] --> +| " +" +| " + +" diff --git a/crates/swc_html_parser/tests/recovery/text/cdata/input.html b/crates/swc_html_parser/tests/recovery/text/cdata/input.html new file mode 100644 index 00000000000..25422d4fb2a --- /dev/null +++ b/crates/swc_html_parser/tests/recovery/text/cdata/input.html @@ -0,0 +1,24 @@ +<!doctype html> +<html lang="en"> +<head> + <title>Document + + +

+

+

+

+

text]]>

+

]]>

+

+

+ +

+

+ + contenta + content + content + + + \ No newline at end of file diff --git a/crates/swc_html_parser/tests/recovery/text/cdata/output.json b/crates/swc_html_parser/tests/recovery/text/cdata/output.json new file mode 100644 index 00000000000..c330cfa4297 --- /dev/null +++ b/crates/swc_html_parser/tests/recovery/text/cdata/output.json @@ -0,0 +1,707 @@ +{ + "type": "Document", + "span": { + "start": 1, + "end": 620, + "ctxt": 0 + }, + "mode": "no-quirks", + "children": [ + { + "type": "DocumentType", + "span": { + "start": 1, + "end": 16, + "ctxt": 0 + }, + "name": "html", + "publicId": null, + "systemId": null, + "raw": "" + }, + { + "type": "Element", + "span": { + "start": 17, + "end": 620, + "ctxt": 0 + }, + "tagName": "html", + "namespace": "http://www.w3.org/1999/xhtml", + "attributes": [ + { + "type": "Attribute", + "span": { + "start": 23, + "end": 32, + "ctxt": 0 + }, + "namespace": null, + "prefix": null, + "name": "lang", + "rawName": "lang", + "value": "en", + "rawValue": "\"en\"" + } + ], + "children": [ + { + "type": "Element", + "span": { + "start": 34, + "end": 76, + "ctxt": 0 + }, + "tagName": "head", + "namespace": "http://www.w3.org/1999/xhtml", + "attributes": [], + "children": [ + { + "type": "Text", + "span": { + "start": 40, + "end": 45, + "ctxt": 0 + }, + "data": "\n ", + "raw": "\n " + }, + { + "type": "Element", + "span": { + "start": 45, + "end": 68, + "ctxt": 0 + }, + "tagName": "title", + "namespace": "http://www.w3.org/1999/xhtml", + "attributes": [], + "children": [ + { + "type": "Text", + "span": { + "start": 52, + "end": 60, + "ctxt": 0 + }, + "data": "Document", + "raw": "Document" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 68, + "end": 69, + "ctxt": 0 + }, + "data": "\n", + "raw": "\n" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 76, + "end": 77, + "ctxt": 0 + }, + "data": "\n", + "raw": "\n" + }, + { + "type": "Element", + "span": { + "start": 77, + "end": 613, + "ctxt": 0 + }, + "tagName": "body", + "namespace": "http://www.w3.org/1999/xhtml", + "attributes": [], + "children": [ + { + "type": "Text", + "span": { + "start": 83, + "end": 84, + "ctxt": 0 + }, + "data": "\n", + "raw": "\n" + }, + { + "type": "Element", + "span": { + "start": 84, + "end": 110, + "ctxt": 0 + }, + "tagName": "p", + "namespace": "http://www.w3.org/1999/xhtml", + "attributes": [], + "children": [ + { + "type": "Comment", + "span": { + "start": 87, + "end": 106, + "ctxt": 0 + }, + "data": "[CDATA[content]]", + "raw": "" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 110, + "end": 111, + "ctxt": 0 + }, + "data": "\n", + "raw": "\n" + }, + { + "type": "Element", + "span": { + "start": 111, + "end": 137, + "ctxt": 0 + }, + "tagName": "p", + "namespace": "http://www.w3.org/1999/xhtml", + "attributes": [], + "children": [ + { + "type": "Comment", + "span": { + "start": 114, + "end": 133, + "ctxt": 0 + }, + "data": "[CDATA[&ing]]", + "raw": "" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 137, + "end": 138, + "ctxt": 0 + }, + "data": "\n", + "raw": "\n" + }, + { + "type": "Element", + "span": { + "start": 138, + "end": 166, + "ctxt": 0 + }, + "tagName": "p", + "namespace": "http://www.w3.org/1999/xhtml", + "attributes": [], + "children": [ + { + "type": "Comment", + "span": { + "start": 141, + "end": 162, + "ctxt": 0 + }, + "data": "[CDATA[&ing ]]]", + "raw": "" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 166, + "end": 167, + "ctxt": 0 + }, + "data": "\n", + "raw": "\n" + }, + { + "type": "Element", + "span": { + "start": 167, + "end": 196, + "ctxt": 0 + }, + "tagName": "p", + "namespace": "http://www.w3.org/1999/xhtml", + "attributes": [], + "children": [ + { + "type": "Comment", + "span": { + "start": 170, + "end": 192, + "ctxt": 0 + }, + "data": "[CDATA[&ing]] ]]", + "raw": "" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 196, + "end": 197, + "ctxt": 0 + }, + "data": "\n", + "raw": "\n" + }, + { + "type": "Element", + "span": { + "start": 197, + "end": 239, + "ctxt": 0 + }, + "tagName": "p", + "namespace": "http://www.w3.org/1999/xhtml", + "attributes": [], + "children": [ + { + "type": "Comment", + "span": { + "start": 200, + "end": 218, + "ctxt": 0 + }, + "data": "[CDATA[" + }, + { + "type": "Text", + "span": { + "start": 218, + "end": 235, + "ctxt": 0 + }, + "data": "text]]>", + "raw": "text]]>" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 239, + "end": 240, + "ctxt": 0 + }, + "data": "\n", + "raw": "\n" + }, + { + "type": "Element", + "span": { + "start": 240, + "end": 310, + "ctxt": 0 + }, + "tagName": "p", + "namespace": "http://www.w3.org/1999/xhtml", + "attributes": [], + "children": [ + { + "type": "Comment", + "span": { + "start": 243, + "end": 303, + "ctxt": 0 + }, + "data": "[CDATA[" + }, + { + "type": "Text", + "span": { + "start": 303, + "end": 306, + "ctxt": 0 + }, + "data": "]]>", + "raw": "]]>" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 310, + "end": 311, + "ctxt": 0 + }, + "data": "\n", + "raw": "\n" + }, + { + "type": "Element", + "span": { + "start": 311, + "end": 344, + "ctxt": 0 + }, + "tagName": "p", + "namespace": "http://www.w3.org/1999/xhtml", + "attributes": [], + "children": [ + { + "type": "Comment", + "span": { + "start": 314, + "end": 327, + "ctxt": 0 + }, + "data": "[CDATA[1]]", + "raw": "" + }, + { + "type": "Comment", + "span": { + "start": 327, + "end": 340, + "ctxt": 0 + }, + "data": "[CDATA[2]]", + "raw": "" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 344, + "end": 345, + "ctxt": 0 + }, + "data": "\n", + "raw": "\n" + }, + { + "type": "Element", + "span": { + "start": 345, + "end": 374, + "ctxt": 0 + }, + "tagName": "p", + "namespace": "http://www.w3.org/1999/xhtml", + "attributes": [], + "children": [ + { + "type": "Text", + "span": { + "start": 348, + "end": 353, + "ctxt": 0 + }, + "data": "\n ", + "raw": "\n " + }, + { + "type": "Comment", + "span": { + "start": 353, + "end": 369, + "ctxt": 0 + }, + "data": "[CDATA[data]]", + "raw": "" + }, + { + "type": "Text", + "span": { + "start": 369, + "end": 370, + "ctxt": 0 + }, + "data": "\n", + "raw": "\n" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 374, + "end": 375, + "ctxt": 0 + }, + "data": "\n", + "raw": "\n" + }, + { + "type": "Element", + "span": { + "start": 375, + "end": 408, + "ctxt": 0 + }, + "tagName": "p", + "namespace": "http://www.w3.org/1999/xhtml", + "attributes": [], + "children": [ + { + "type": "Comment", + "span": { + "start": 378, + "end": 404, + "ctxt": 0 + }, + "data": "[CDATA[bracket ]after]]", + "raw": "" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 408, + "end": 409, + "ctxt": 0 + }, + "data": "\n", + "raw": "\n" + }, + { + "type": "Element", + "span": { + "start": 409, + "end": 604, + "ctxt": 0 + }, + "tagName": "svg", + "namespace": "http://www.w3.org/2000/svg", + "attributes": [ + { + "type": "Attribute", + "span": { + "start": 414, + "end": 435, + "ctxt": 0 + }, + "namespace": null, + "prefix": null, + "name": "viewBox", + "rawName": "viewBox", + "value": "0 0 100 100", + "rawValue": "\"0 0 100 100\"" + } + ], + "children": [ + { + "type": "Text", + "span": { + "start": 436, + "end": 441, + "ctxt": 0 + }, + "data": "\n ", + "raw": "\n " + }, + { + "type": "Element", + "span": { + "start": 441, + "end": 521, + "ctxt": 0 + }, + "tagName": "foreignObject", + "namespace": "http://www.w3.org/2000/svg", + "attributes": [ + { + "type": "Attribute", + "span": { + "start": 456, + "end": 469, + "ctxt": 0 + }, + "namespace": null, + "prefix": null, + "name": "width", + "rawName": "width", + "value": "100px", + "rawValue": "\"100px\"" + }, + { + "type": "Attribute", + "span": { + "start": 470, + "end": 484, + "ctxt": 0 + }, + "namespace": null, + "prefix": null, + "name": "height", + "rawName": "height", + "value": "100px", + "rawValue": "\"100px\"" + } + ], + "children": [ + { + "type": "Comment", + "span": { + "start": 485, + "end": 504, + "ctxt": 0 + }, + "data": "[CDATA[content]]", + "raw": "" + }, + { + "type": "Text", + "span": { + "start": 504, + "end": 505, + "ctxt": 0 + }, + "data": "a", + "raw": "a" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 521, + "end": 526, + "ctxt": 0 + }, + "data": "\n ", + "raw": "\n " + }, + { + "type": "Element", + "span": { + "start": 526, + "end": 558, + "ctxt": 0 + }, + "tagName": "desc", + "namespace": "http://www.w3.org/2000/svg", + "attributes": [], + "children": [ + { + "type": "Comment", + "span": { + "start": 532, + "end": 551, + "ctxt": 0 + }, + "data": "[CDATA[content]]", + "raw": "" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 558, + "end": 563, + "ctxt": 0 + }, + "data": "\n ", + "raw": "\n " + }, + { + "type": "Element", + "span": { + "start": 563, + "end": 597, + "ctxt": 0 + }, + "tagName": "title", + "namespace": "http://www.w3.org/2000/svg", + "attributes": [], + "children": [ + { + "type": "Comment", + "span": { + "start": 570, + "end": 589, + "ctxt": 0 + }, + "data": "[CDATA[content]]", + "raw": "" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 597, + "end": 598, + "ctxt": 0 + }, + "data": "\n", + "raw": "\n" + } + ], + "content": null, + "isSelfClosing": false + }, + { + "type": "Text", + "span": { + "start": 604, + "end": 613, + "ctxt": 0 + }, + "data": "\n\n", + "raw": "\n\n" + } + ], + "content": null, + "isSelfClosing": false + } + ], + "content": null, + "isSelfClosing": false + } + ] +} diff --git a/crates/swc_html_parser/tests/recovery/text/cdata/output.stderr b/crates/swc_html_parser/tests/recovery/text/cdata/output.stderr new file mode 100644 index 00000000000..cbd42e5932f --- /dev/null +++ b/crates/swc_html_parser/tests/recovery/text/cdata/output.stderr @@ -0,0 +1,112 @@ + + x Cdata in html content + ,-[$DIR/tests/recovery/text/cdata/input.html:6:1] + 6 | + 7 |

+ : ^ + 8 |

+ `---- + + x Cdata in html content + ,-[$DIR/tests/recovery/text/cdata/input.html:7:1] + 7 |

+ 8 |

+ : ^ + 9 |

+ `---- + + x Cdata in html content + ,-[$DIR/tests/recovery/text/cdata/input.html:8:1] + 8 |

+ 9 |

+ : ^ + 10 |

+ `---- + + x Cdata in html content + ,-[$DIR/tests/recovery/text/cdata/input.html:9:1] + 9 |

+ 10 |

+ : ^ + 11 |

text]]>

+ `---- + + x Cdata in html content + ,-[$DIR/tests/recovery/text/cdata/input.html:10:1] + 10 |

+ 11 |

text]]>

+ : ^ + 12 |

]]>

+ `---- + + x Stray end tag "message" + ,-[$DIR/tests/recovery/text/cdata/input.html:10:1] + 10 |

+ 11 |

text]]>

+ : ^^^^^^^^^^ + 12 |

]]>

+ `---- + + x Cdata in html content + ,-[$DIR/tests/recovery/text/cdata/input.html:11:1] + 11 |

text]]>

+ 12 |

]]>

+ : ^ + 13 |

+ `---- + + x Cdata in html content + ,-[$DIR/tests/recovery/text/cdata/input.html:12:1] + 12 |

]]>

+ 13 |

+ : ^ + 14 |

+ `---- + + x Cdata in html content + ,-[$DIR/tests/recovery/text/cdata/input.html:12:1] + 12 |

]]>

+ 13 |

+ : ^ + 14 |

+ `---- + + x Cdata in html content + ,-[$DIR/tests/recovery/text/cdata/input.html:14:1] + 14 |

+ 15 | + : ^ + 16 |

+ `---- + + x Cdata in html content + ,-[$DIR/tests/recovery/text/cdata/input.html:16:1] + 16 |

+ 17 |

+ : ^ + 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 new file mode 100644 index 00000000000..ac089e56d08 --- /dev/null +++ b/crates/swc_html_parser/tests/recovery/text/cdata/span.rust-debug @@ -0,0 +1,1048 @@ + + x Document + ,-[$DIR/tests/recovery/text/cdata/input.html:1:1] + 1 | ,-> + 2 | | + 3 | | + 4 | | Document + 5 | | + 6 | | + 7 | |

+ 8 | |

+ 9 | |

+ 10 | |

+ 11 | |

text]]>

+ 12 | |

]]>

+ 13 | |

+ 14 | |

+ 15 | | + 16 | |

+ 17 | |

+ 18 | | + 19 | | contenta + 20 | | content + 21 | | content + 22 | | + 23 | | + 24 | `-> + `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:1:1] + 1 | + : ^^^^^^^^^^^^^^^ + 2 | + `---- + + x DocumentType + ,-[$DIR/tests/recovery/text/cdata/input.html:1:1] + 1 | + : ^^^^^^^^^^^^^^^ + 2 | + `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:1:1] + 1 | + 2 | ,-> + 3 | | + 4 | | Document + 5 | | + 6 | | + 7 | |

+ 8 | |

+ 9 | |

+ 10 | |

+ 11 | |

text]]>

+ 12 | |

]]>

+ 13 | |

+ 14 | |

+ 15 | | + 16 | |

+ 17 | |

+ 18 | | + 19 | | contenta + 20 | | content + 21 | | content + 22 | | + 23 | | + 24 | `-> + `---- + + x Element + ,-[$DIR/tests/recovery/text/cdata/input.html:1:1] + 1 | + 2 | ,-> + 3 | | + 4 | | Document + 5 | | + 6 | | + 7 | |

+ 8 | |

+ 9 | |

+ 10 | |

+ 11 | |

text]]>

+ 12 | |

]]>

+ 13 | |

+ 14 | |

+ 15 | | + 16 | |

+ 17 | |

+ 18 | | + 19 | | contenta + 20 | | content + 21 | | content + 22 | | + 23 | | + 24 | `-> + `---- + + x Attribute + ,-[$DIR/tests/recovery/text/cdata/input.html:1:1] + 1 | + 2 | + : ^^^^^^^^^ + 3 | + `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:2:1] + 2 | + 3 | ,-> + 4 | | Document + 5 | `-> + 6 | + `---- + + x Element + ,-[$DIR/tests/recovery/text/cdata/input.html:2:1] + 2 | + 3 | ,-> + 4 | | Document + 5 | `-> + 6 | + `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:2:1] + 2 | + 3 | ,-> + 4 | `-> Document + 5 | + `---- + + x Text + ,-[$DIR/tests/recovery/text/cdata/input.html:2:1] + 2 | + 3 | ,-> + 4 | `-> Document + 5 | + `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:3:1] + 3 | + 4 | Document + : ^^^^^^^^^^^^^^^^^^^^^^^ + 5 | + `---- + + x Element + ,-[$DIR/tests/recovery/text/cdata/input.html:3:1] + 3 | + 4 | Document + : ^^^^^^^^^^^^^^^^^^^^^^^ + 5 | + `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:3:1] + 3 | + 4 | Document + : ^^^^^^^^ + 5 | + `---- + + x Text + ,-[$DIR/tests/recovery/text/cdata/input.html:3:1] + 3 | + 4 | Document + : ^^^^^^^^ + 5 | + `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:3:1] + 3 | + 4 | Document + : ^ + 5 | + 6 | + `---- + + x Text + ,-[$DIR/tests/recovery/text/cdata/input.html:3:1] + 3 | + 4 | Document + : ^ + 5 | + 6 | + `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:4:1] + 4 | Document + 5 | + : ^ + 6 | + 7 |

+ `---- + + x Text + ,-[$DIR/tests/recovery/text/cdata/input.html:4:1] + 4 | Document + 5 | + : ^ + 6 | + 7 |

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:5:1] + 5 | + 6 | ,-> + 7 | |

+ 8 | |

+ 9 | |

+ 10 | |

+ 11 | |

text]]>

+ 12 | |

]]>

+ 13 | |

+ 14 | |

+ 15 | | + 16 | |

+ 17 | |

+ 18 | | + 19 | | contenta + 20 | | content + 21 | | content + 22 | | + 23 | `-> + 24 | + `---- + + x Element + ,-[$DIR/tests/recovery/text/cdata/input.html:5:1] + 5 | + 6 | ,-> + 7 | |

+ 8 | |

+ 9 | |

+ 10 | |

+ 11 | |

text]]>

+ 12 | |

]]>

+ 13 | |

+ 14 | |

+ 15 | | + 16 | |

+ 17 | |

+ 18 | | + 19 | | contenta + 20 | | content + 21 | | content + 22 | | + 23 | `-> + 24 | + `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:5:1] + 5 | + 6 | + : ^ + 7 |

+ 8 |

+ `---- + + x Text + ,-[$DIR/tests/recovery/text/cdata/input.html:5:1] + 5 | + 6 | + : ^ + 7 |

+ 8 |

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:6:1] + 6 | + 7 |

+ : ^^^^^^^^^^^^^^^^^^^^^^^^^^ + 8 |

+ `---- + + x Element + ,-[$DIR/tests/recovery/text/cdata/input.html:6:1] + 6 | + 7 |

+ : ^^^^^^^^^^^^^^^^^^^^^^^^^^ + 8 |

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:6:1] + 6 | + 7 |

+ : ^^^^^^^^^^^^^^^^^^^ + 8 |

+ `---- + + x Comment + ,-[$DIR/tests/recovery/text/cdata/input.html:6:1] + 6 | + 7 |

+ : ^^^^^^^^^^^^^^^^^^^ + 8 |

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:6:1] + 6 | + 7 |

+ : ^ + 8 |

+ 9 |

+ `---- + + x Text + ,-[$DIR/tests/recovery/text/cdata/input.html:6:1] + 6 | + 7 |

+ : ^ + 8 |

+ 9 |

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:7:1] + 7 |

+ 8 |

+ : ^^^^^^^^^^^^^^^^^^^^^^^^^^ + 9 |

+ `---- + + x Element + ,-[$DIR/tests/recovery/text/cdata/input.html:7:1] + 7 |

+ 8 |

+ : ^^^^^^^^^^^^^^^^^^^^^^^^^^ + 9 |

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:7:1] + 7 |

+ 8 |

+ : ^^^^^^^^^^^^^^^^^^^ + 9 |

+ `---- + + x Comment + ,-[$DIR/tests/recovery/text/cdata/input.html:7:1] + 7 |

+ 8 |

+ : ^^^^^^^^^^^^^^^^^^^ + 9 |

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:7:1] + 7 |

+ 8 |

+ : ^ + 9 |

+ 10 |

+ `---- + + x Text + ,-[$DIR/tests/recovery/text/cdata/input.html:7:1] + 7 |

+ 8 |

+ : ^ + 9 |

+ 10 |

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:8:1] + 8 |

+ 9 |

+ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 10 |

+ `---- + + x Element + ,-[$DIR/tests/recovery/text/cdata/input.html:8:1] + 8 |

+ 9 |

+ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 10 |

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:8:1] + 8 |

+ 9 |

+ : ^^^^^^^^^^^^^^^^^^^^^ + 10 |

+ `---- + + x Comment + ,-[$DIR/tests/recovery/text/cdata/input.html:8:1] + 8 |

+ 9 |

+ : ^^^^^^^^^^^^^^^^^^^^^ + 10 |

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:8:1] + 8 |

+ 9 |

+ : ^ + 10 |

+ 11 |

text]]>

+ `---- + + x Text + ,-[$DIR/tests/recovery/text/cdata/input.html:8:1] + 8 |

+ 9 |

+ : ^ + 10 |

+ 11 |

text]]>

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:9:1] + 9 |

+ 10 |

+ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 11 |

text]]>

+ `---- + + x Element + ,-[$DIR/tests/recovery/text/cdata/input.html:9:1] + 9 |

+ 10 |

+ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 11 |

text]]>

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:9:1] + 9 |

+ 10 |

+ : ^^^^^^^^^^^^^^^^^^^^^^ + 11 |

text]]>

+ `---- + + x Comment + ,-[$DIR/tests/recovery/text/cdata/input.html:9:1] + 9 |

+ 10 |

+ : ^^^^^^^^^^^^^^^^^^^^^^ + 11 |

text]]>

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:9:1] + 9 |

+ 10 |

+ : ^ + 11 |

text]]>

+ 12 |

]]>

+ `---- + + x Text + ,-[$DIR/tests/recovery/text/cdata/input.html:9:1] + 9 |

+ 10 |

+ : ^ + 11 |

text]]>

+ 12 |

]]>

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:10:1] + 10 |

+ 11 |

text]]>

+ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 12 |

]]>

+ `---- + + x Element + ,-[$DIR/tests/recovery/text/cdata/input.html:10:1] + 10 |

+ 11 |

text]]>

+ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 12 |

]]>

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:10:1] + 10 |

+ 11 |

text]]>

+ : ^^^^^^^^^^^^^^^^^^ + 12 |

]]>

+ `---- + + x Comment + ,-[$DIR/tests/recovery/text/cdata/input.html:10:1] + 10 |

+ 11 |

text]]>

+ : ^^^^^^^^^^^^^^^^^^ + 12 |

]]>

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:10:1] + 10 |

+ 11 |

text]]>

+ : ^^^^^^^^^^^^^^^^^ + 12 |

]]>

+ `---- + + x Text + ,-[$DIR/tests/recovery/text/cdata/input.html:10:1] + 10 |

+ 11 |

text]]>

+ : ^^^^^^^^^^^^^^^^^ + 12 |

]]>

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:10:1] + 10 |

+ 11 |

text]]>

+ : ^ + 12 |

]]>

+ 13 |

+ `---- + + x Text + ,-[$DIR/tests/recovery/text/cdata/input.html:10:1] + 10 |

+ 11 |

text]]>

+ : ^ + 12 |

]]>

+ 13 |

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:11:1] + 11 |

text]]>

+ 12 |

]]>

+ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 13 |

+ `---- + + x Element + ,-[$DIR/tests/recovery/text/cdata/input.html:11:1] + 11 |

text]]>

+ 12 |

]]>

+ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 13 |

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:11:1] + 11 |

text]]>

+ 12 |

]]>

+ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 13 |

+ `---- + + x Comment + ,-[$DIR/tests/recovery/text/cdata/input.html:11:1] + 11 |

text]]>

+ 12 |

]]>

+ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 13 |

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:11:1] + 11 |

text]]>

+ 12 |

]]>

+ : ^^^ + 13 |

+ `---- + + x Text + ,-[$DIR/tests/recovery/text/cdata/input.html:11:1] + 11 |

text]]>

+ 12 |

]]>

+ : ^^^ + 13 |

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:11:1] + 11 |

text]]>

+ 12 |

]]>

+ : ^ + 13 |

+ 14 |

+ `---- + + x Text + ,-[$DIR/tests/recovery/text/cdata/input.html:11:1] + 11 |

text]]>

+ 12 |

]]>

+ : ^ + 13 |

+ 14 |

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:12:1] + 12 |

]]>

+ 13 |

+ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 14 |

+ `---- + + x Element + ,-[$DIR/tests/recovery/text/cdata/input.html:12:1] + 12 |

]]>

+ 13 |

+ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 14 |

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:12:1] + 12 |

]]>

+ 13 |

+ : ^^^^^^^^^^^^^ + 14 |

+ `---- + + x Comment + ,-[$DIR/tests/recovery/text/cdata/input.html:12:1] + 12 |

]]>

+ 13 |

+ : ^^^^^^^^^^^^^ + 14 |

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:12:1] + 12 |

]]>

+ 13 |

+ : ^^^^^^^^^^^^^ + 14 |

+ `---- + + x Comment + ,-[$DIR/tests/recovery/text/cdata/input.html:12:1] + 12 |

]]>

+ 13 |

+ : ^^^^^^^^^^^^^ + 14 |

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:12:1] + 12 |

]]>

+ 13 |

+ : ^ + 14 |

+ 15 | + `---- + + x Text + ,-[$DIR/tests/recovery/text/cdata/input.html:12:1] + 12 |

]]>

+ 13 |

+ : ^ + 14 |

+ 15 | + `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:13:1] + 13 |

+ 14 | ,->

+ 15 | | + 16 | `->

+ 17 |

+ `---- + + x Element + ,-[$DIR/tests/recovery/text/cdata/input.html:13:1] + 13 |

+ 14 | ,->

+ 15 | | + 16 | `->

+ 17 |

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:13:1] + 13 |

+ 14 | ,->

+ 15 | `-> + 16 |

+ `---- + + x Text + ,-[$DIR/tests/recovery/text/cdata/input.html:13:1] + 13 |

+ 14 | ,->

+ 15 | `-> + 16 |

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:14:1] + 14 |

+ 15 | + : ^^^^^^^^^^^^^^^^ + 16 |

+ `---- + + x Comment + ,-[$DIR/tests/recovery/text/cdata/input.html:14:1] + 14 |

+ 15 | + : ^^^^^^^^^^^^^^^^ + 16 |

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:14:1] + 14 |

+ 15 | + : ^ + 16 |

+ 17 |

+ `---- + + x Text + ,-[$DIR/tests/recovery/text/cdata/input.html:14:1] + 14 |

+ 15 | + : ^ + 16 |

+ 17 |

+ `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:15:1] + 15 | + 16 |

+ : ^ + 17 |

+ 18 | + `---- + + x Text + ,-[$DIR/tests/recovery/text/cdata/input.html:15:1] + 15 | data + 16 |

+ : ^ + 17 |

+ 18 | + `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:16:1] + 16 |

+ 17 |

+ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 18 | + `---- + + x Element + ,-[$DIR/tests/recovery/text/cdata/input.html:16:1] + 16 |

+ 17 |

+ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 18 | + `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:16:1] + 16 |

+ 17 |

+ : ^^^^^^^^^^^^^^^^^^^^^^^^^^ + 18 | + `---- + + x Comment + ,-[$DIR/tests/recovery/text/cdata/input.html:16:1] + 16 |

+ 17 |

+ : ^^^^^^^^^^^^^^^^^^^^^^^^^^ + 18 | + `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:16:1] + 16 |

+ 17 |

+ : ^ + 18 | + 19 | contenta + `---- + + x Text + ,-[$DIR/tests/recovery/text/cdata/input.html:16:1] + 16 |

+ 17 |

+ : ^ + 18 | + 19 | contenta + `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:17:1] + 17 |

+ 18 | ,-> + 19 | | contenta + 20 | | content + 21 | | content + 22 | `-> + 23 | + `---- + + x Element + ,-[$DIR/tests/recovery/text/cdata/input.html:17:1] + 17 |

+ 18 | ,-> + 19 | | contenta + 20 | | content + 21 | | content + 22 | `-> + 23 | + `---- + + x Attribute + ,-[$DIR/tests/recovery/text/cdata/input.html:17:1] + 17 |

+ 18 | + : ^^^^^^^^^^^^^^^^^^^^^ + 19 | contenta + `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:17:1] + 17 |

+ 18 | ,-> + 19 | `-> contenta + 20 | content + `---- + + x Text + ,-[$DIR/tests/recovery/text/cdata/input.html:17:1] + 17 |

+ 18 | ,-> + 19 | `-> contenta + 20 | content + `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:18:1] + 18 | + 19 | contenta + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 20 | content + `---- + + x Element + ,-[$DIR/tests/recovery/text/cdata/input.html:18:1] + 18 | + 19 | contenta + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 20 | content + `---- + + x Attribute + ,-[$DIR/tests/recovery/text/cdata/input.html:18:1] + 18 | + 19 | contenta + : ^^^^^^^^^^^^^ + 20 | content + `---- + + x Attribute + ,-[$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 + `---- + + 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 + `---- + + x Text + ,-[$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 + 21 | content + `---- + + x Text + ,-[$DIR/tests/recovery/text/cdata/input.html:18:1] + 18 | + 19 | ,-> contenta + 20 | `-> content + 21 | content + `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:19:1] + 19 | contenta + 20 | content + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 21 | content + `---- + + x Element + ,-[$DIR/tests/recovery/text/cdata/input.html:19:1] + 19 | contenta + 20 | content + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 21 | content + `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:19:1] + 19 | contenta + 20 | content + : ^^^^^^^^^^^^^^^^^^^ + 21 | content + `---- + + x Comment + ,-[$DIR/tests/recovery/text/cdata/input.html:19:1] + 19 | contenta + 20 | content + : ^^^^^^^^^^^^^^^^^^^ + 21 | content + `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:19:1] + 19 | contenta + 20 | ,-> content + 21 | `-> content + 22 | + `---- + + x Text + ,-[$DIR/tests/recovery/text/cdata/input.html:19:1] + 19 | contenta + 20 | ,-> content + 21 | `-> content + 22 | + `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:20:1] + 20 | content + 21 | content + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 22 | + `---- + + x Element + ,-[$DIR/tests/recovery/text/cdata/input.html:20:1] + 20 | content + 21 | content + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 22 | + `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:20:1] + 20 | content + 21 | content + : ^^^^^^^^^^^^^^^^^^^ + 22 | + `---- + + x Comment + ,-[$DIR/tests/recovery/text/cdata/input.html:20:1] + 20 | content + 21 | content + : ^^^^^^^^^^^^^^^^^^^ + 22 | + `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:20:1] + 20 | content + 21 | content + : ^ + 22 | + 23 | + `---- + + x Text + ,-[$DIR/tests/recovery/text/cdata/input.html:20:1] + 20 | content + 21 | content + : ^ + 22 | + 23 | + `---- + + x Child + ,-[$DIR/tests/recovery/text/cdata/input.html:21:1] + 21 | content + 22 | ,-> + 23 | `-> + 24 | + `---- + + x Text + ,-[$DIR/tests/recovery/text/cdata/input.html:21:1] + 21 | content + 22 | ,-> + 23 | `-> + 24 | + `----