diff --git a/crates/swc_html_parser/src/error.rs b/crates/swc_html_parser/src/error.rs
index 821d59d18b9..9f5451a1814 100644
--- a/crates/swc_html_parser/src/error.rs
+++ b/crates/swc_html_parser/src/error.rs
@@ -30,232 +30,226 @@ impl Error {
pub fn message(&self) -> Cow<'static, str> {
match &self.inner.1 {
ErrorKind::Eof => "Unexpected end of file".into(),
- ErrorKind::ControlCharacterInInputStream => "Control character in input stream".into(),
- ErrorKind::NoncharacterInInputStream => "Noncharacter in input stream".into(),
- ErrorKind::SurrogateInInputStream => "Surrogate in input stream".into(),
- ErrorKind::NonVoidHtmlElementStartTagWithTrailingSolidus => {
- "Non void html element start tag with trailing solidus".into()
+
+ // Lexer errors
+ ErrorKind::AbruptClosingOfEmptyComment => "Abrupt closing of empty comment".into(),
+ ErrorKind::AbruptDoctypePublicIdentifier => "Abrupt doctype public identifier".into(),
+ ErrorKind::AbruptDoctypeSystemIdentifier => "Abrupt doctype system identifier".into(),
+ ErrorKind::AbsenceOfDigitsInNumericCharacterReference => {
+ "Absence of digits in numeric character reference".into()
}
+ ErrorKind::CdataInHtmlContent => "Cdata in html content".into(),
+ ErrorKind::CharacterReferenceOutsideUnicodeRange => {
+ "Character reference outside unicode range".into()
+ }
+ ErrorKind::ControlCharacterInInputStream => "Control character in input stream".into(),
+ ErrorKind::ControlCharacterReference => "Control character reference".into(),
ErrorKind::EndTagWithAttributes => "End tag with attributes".into(),
+ ErrorKind::DuplicateAttribute => "Duplicate attribute".into(),
ErrorKind::EndTagWithTrailingSolidus => "End tag with trailing solidus".into(),
- ErrorKind::UnexpectedSolidusInTag => "Unexpected solidus in tag".into(),
- ErrorKind::UnexpectedNullCharacter => "Unexpected null character".into(),
- ErrorKind::UnexpectedQuestionMarkInsteadOfTagName => {
- "Unexpected question mark instead of tag name".into()
+ ErrorKind::EofBeforeTagName => "Eof before tag name".into(),
+ ErrorKind::EofInCdata => "Eof in cdata".into(),
+ ErrorKind::EofInComment => "Eof in comment".into(),
+ ErrorKind::EofInDoctype => "Eof in doctype".into(),
+ ErrorKind::EofInScriptHtmlCommentLikeText => {
+ "Eof in script html comment like text".into()
+ }
+ ErrorKind::EofInTag => "Eof in tag".into(),
+ ErrorKind::IncorrectlyClosedComment => "Incorrectly closed comment".into(),
+ ErrorKind::IncorrectlyOpenedComment => "Incorrectly opened comment".into(),
+ ErrorKind::InvalidCharacterSequenceAfterDoctypeName => {
+ "Invalid character sequence after doctype name".into()
}
ErrorKind::InvalidFirstCharacterOfTagName => {
"Invalid first character of tag name".into()
}
- ErrorKind::UnexpectedEqualsSignBeforeAttributeName => {
- "Unexpected equals sign before attribute name".into()
- }
- ErrorKind::MissingEndTagName => "Missing end tag name".into(),
- ErrorKind::UnexpectedCharacterInAttributeName => {
- "Unexpected character in attribute name".into()
- }
- ErrorKind::UnknownNamedCharacterReference => "Unknown named character reference".into(),
- ErrorKind::MissingSemicolonAfterCharacterReference => {
- "Missing semicolon after character reference".into()
- }
- ErrorKind::UnexpectedCharacterAfterDoctypeSystemIdentifier => {
- "Unexpected character after doctype system identifier".into()
- }
- ErrorKind::UnexpectedCharacterInUnquotedAttributeValue => {
- "Unexpected character in unquoted attribute value".into()
- }
- ErrorKind::EofBeforeTagName => "Eof before tag name".into(),
- ErrorKind::EofInTag => "Eof in tag".into(),
ErrorKind::MissingAttributeValue => "Missing attribute value".into(),
- ErrorKind::MissingWhitespaceBetweenAttributes => {
- "Missing whitespace between attributes".into()
- }
- ErrorKind::MissingWhitespaceAfterDoctypePublicKeyword => {
- "Missing whitespace after doctype public keyword".into()
- }
- ErrorKind::MissingWhitespaceBetweenDoctypePublicAndSystemIdentifiers => {
- "Missing whitespace between doctype public and system identifiers".into()
- }
- ErrorKind::MissingWhitespaceAfterDoctypeSystemKeyword => {
- "Missing whitespace after doctype system keyword".into()
- }
+ ErrorKind::MissingDoctypeName => "Missing doctype name".into(),
+ ErrorKind::MissingDoctypePublicIdentifier => "Missing doctype public identifier".into(),
+ ErrorKind::MissingDoctypeSystemIdentifier => "Missing doctype system identifier".into(),
+ ErrorKind::MissingEndTagName => "Missing end tag name".into(),
ErrorKind::MissingQuoteBeforeDoctypePublicIdentifier => {
"Missing quote before doctype public identifier".into()
}
ErrorKind::MissingQuoteBeforeDoctypeSystemIdentifier => {
"Missing quote before doctype system identifier".into()
}
- ErrorKind::MissingDoctypePublicIdentifier => "Missing doctype public identifier".into(),
- ErrorKind::MissingDoctypeSystemIdentifier => "Missing doctype system identifier".into(),
- ErrorKind::AbruptDoctypePublicIdentifier => "Abrupt doctype public identifier".into(),
- ErrorKind::AbruptDoctypeSystemIdentifier => "Abrupt doctype system identifier".into(),
- ErrorKind::CdataInHtmlContent => "Cdata in html content".into(),
- ErrorKind::IncorrectlyOpenedComment => "Incorrectly opened comment".into(),
- ErrorKind::EofInScriptHtmlCommentLikeText => {
- "Eof in script html comment like text".into()
+ ErrorKind::MissingSemicolonAfterCharacterReference => {
+ "Missing semicolon after character reference".into()
}
- ErrorKind::EofInDoctype => "Eof in doctype".into(),
- ErrorKind::NestedComment => "Nested comment".into(),
- ErrorKind::AbruptClosingOfEmptyComment => "Abrupt closing of empty comment".into(),
- ErrorKind::EofInComment => "Eof in comment".into(),
- ErrorKind::IncorrectlyClosedComment => "Incorrectly closed comment".into(),
- ErrorKind::EofInCdata => "Eof in cdata".into(),
- ErrorKind::AbsenceOfDigitsInNumericCharacterReference => {
- "Absence of digits in numeric character reference".into()
+ ErrorKind::MissingWhitespaceAfterDoctypePublicKeyword => {
+ "Missing whitespace after doctype public keyword".into()
}
- ErrorKind::NullCharacterReference => "Null character reference".into(),
- ErrorKind::SurrogateCharacterReference => "Surrogate character reference".into(),
- ErrorKind::CharacterReferenceOutsideUnicodeRange => {
- "Character reference outside unicode range".into()
+ ErrorKind::MissingWhitespaceAfterDoctypeSystemKeyword => {
+ "Missing whitespace after doctype system keyword".into()
}
- ErrorKind::ControlCharacterReference => "Control character reference".into(),
- ErrorKind::NoncharacterCharacterReference => "Noncharacter character reference".into(),
ErrorKind::MissingWhitespaceBeforeDoctypeName => {
"Missing whitespace before doctype name".into()
}
- ErrorKind::MissingDoctypeName => "Missing doctype name".into(),
- ErrorKind::InvalidCharacterSequenceAfterDoctypeName => {
- "Invalid character sequence after doctype name".into()
+ ErrorKind::MissingWhitespaceBetweenAttributes => {
+ "Missing whitespace between attributes".into()
}
- ErrorKind::DuplicateAttribute => "Duplicate attribute".into(),
- ErrorKind::NonConformingDoctype => "Non conforming doctype".into(),
- ErrorKind::MissingDoctype => "Missing doctype".into(),
- ErrorKind::MisplacedDoctype => "Misplaced doctype".into(),
- ErrorKind::EndTagWithoutMatchingOpenElement => {
- "End tag without matching open element".into()
+ ErrorKind::MissingWhitespaceBetweenDoctypePublicAndSystemIdentifiers => {
+ "Missing whitespace between doctype public and system identifiers".into()
}
- ErrorKind::ClosingOfElementWithOpenChildElements => {
- "Closing of element with open child elements".into()
+ ErrorKind::NestedComment => "Nested comment".into(),
+ ErrorKind::NoncharacterCharacterReference => "Noncharacter character reference".into(),
+ ErrorKind::NoncharacterInInputStream => "Noncharacter in input stream".into(),
+ ErrorKind::NonVoidHtmlElementStartTagWithTrailingSolidus => {
+ "Non void html element start tag with trailing solidus".into()
}
- ErrorKind::DisallowedContentInNoscriptInHead => {
- "Disallowed content in noscript in head".into()
+ ErrorKind::NullCharacterReference => "Null character reference".into(),
+ ErrorKind::SurrogateCharacterReference => "Surrogate character reference".into(),
+ ErrorKind::SurrogateInInputStream => "Surrogate in input stream".into(),
+ ErrorKind::UnexpectedCharacterAfterDoctypeSystemIdentifier => {
+ "Unexpected character after doctype system identifier".into()
}
- ErrorKind::OpenElementsLeftAfterEof => "Open elements left after eof".into(),
- ErrorKind::AbandonedHeadElementChild => "Abandoned head element child".into(),
- ErrorKind::MisplacedStartTagForHeadElement => {
- "Misplaced start tag for head element".into()
+ ErrorKind::UnexpectedCharacterInAttributeName => {
+ "Unexpected character in attribute name".into()
}
- ErrorKind::NestedNoscriptInHead => "Nested noscript in head".into(),
- ErrorKind::EofInElementThatCanContainOnlyText => {
- "Eof in element that can contain only text".into()
+ ErrorKind::UnexpectedCharacterInUnquotedAttributeValue => {
+ "Unexpected character in unquoted attribute value".into()
}
- ErrorKind::UnexpectedToken => "Unexpected token".into(),
- ErrorKind::NestedHeadingTags => "Heading cannot be a child of another heading".into(),
- ErrorKind::UnexpectedStartSelectWhereEndSelectExpected => {
- "Unexpected \"\" start tag where end tag expected".into()
+ ErrorKind::UnexpectedEqualsSignBeforeAttributeName => {
+ "Unexpected equals sign before attribute name".into()
}
- ErrorKind::NoTableRowToClose => "No table row to close".into(),
- ErrorKind::UnexpectedHtmlStartTagInForeignContext(tag_name) => format!(
- "Unexpected HTML start tag \"<{}>\" in a foreign namespace context",
- tag_name
- )
- .into(),
- ErrorKind::UnexpectedHtmlEndTagInForeignContext(tag_name) => format!(
- "Unexpected HTML end tag \"{}>\" in a foreign namespace context",
- tag_name
- )
- .into(),
- ErrorKind::UnexpectedStartTagBetweenHeadAndBody(tag_name) => format!(
- "Unexpected HTML start tag \"<{}>\" between \"\" and \"\"",
- tag_name
- )
- .into(),
- ErrorKind::StrayDoctype => "Stray doctype".into(),
+ ErrorKind::UnexpectedNullCharacter => "Unexpected null character".into(),
+ ErrorKind::UnexpectedQuestionMarkInsteadOfTagName => {
+ "Unexpected question mark instead of tag name".into()
+ }
+ ErrorKind::UnexpectedSolidusInTag => "Unexpected solidus in tag".into(),
+ ErrorKind::UnknownNamedCharacterReference => "Unknown named character reference".into(),
+
+ // Parser errors
ErrorKind::StrayStartTag(tag_name) => {
- format!("Stray start tag \"<{}>\"", tag_name).into()
+ format!("Stray start tag \"{}\"", tag_name).into()
}
- ErrorKind::StrayEndTag(tag_name) => format!("Stray end tag \"{}>\"", tag_name).into(),
- ErrorKind::UnclosedElementsImplied(tag_name) => format!(
- "End tag \"{}>\" implied, but there were open elements",
- tag_name
- )
- .into(),
+ ErrorKind::StrayEndTag(tag_name) => format!("Stray end tag \"{}\"", tag_name).into(),
ErrorKind::UnclosedElements(tag_name) => format!(
- "End tag \"{}>\" seen, but there were open elements",
+ "End tag \"{}\" seen, but there were open elements",
tag_name
)
.into(),
- ErrorKind::UnexpectedEndTag(tag_name) => {
- format!("Unexpected end tag \"{}>\"", tag_name).into()
- }
- ErrorKind::StartTagSeenWhenAlreadyOpen(tag_name) => format!(
- "Start tag \"<{}>\" seen but an element of the same type was already open",
+ ErrorKind::UnclosedElementsImplied(tag_name) => format!(
+ "End tag \"{}\" implied, but there were open elements",
tag_name
)
.into(),
- ErrorKind::TableSeenWhileTableOpen => {
- "Start tag for \"\" seen but the previous \"\" is still open".into()
- }
- ErrorKind::UnexpectedStartTagInTable(tag_name) => format!(
- "Unexpected start tag \"<{}>\" seen in \"\"",
- tag_name
- )
- .into(),
- ErrorKind::NoElementToCloseButEndTagSeen(tag_name) => format!(
- "No \"{}\" element in scope but a \"{}>\" end tag seen",
- tag_name, tag_name
- )
- .into(),
- ErrorKind::UnclosedElementsOnStack => "Unclosed elements on stack".into(),
- ErrorKind::FormWhenFormOpen => "Saw a \"
+| "
+"
+|
+| content
+|
+| "
+"
+|
+| content
+|
+| "
+"
+|
+| content
+|
+| "
+"
diff --git a/crates/swc_html_parser/tests/recovery/element/colgroup-1/input.html b/crates/swc_html_parser/tests/recovery/element/colgroup-1/input.html
new file mode 100644
index 00000000000..f81457f8c15
--- /dev/null
+++ b/crates/swc_html_parser/tests/recovery/element/colgroup-1/input.html
@@ -0,0 +1,5 @@
+
+
+
+A
+
\ No newline at end of file
diff --git a/crates/swc_html_parser/tests/recovery/element/colgroup-1/output.json b/crates/swc_html_parser/tests/recovery/element/colgroup-1/output.json
new file mode 100644
index 00000000000..5760d3b2b9f
--- /dev/null
+++ b/crates/swc_html_parser/tests/recovery/element/colgroup-1/output.json
@@ -0,0 +1,193 @@
+{
+ "type": "Document",
+ "span": {
+ "start": 1,
+ "end": 133,
+ "ctxt": 0
+ },
+ "mode": "quirks",
+ "children": [
+ {
+ "type": "Element",
+ "span": {
+ "start": 0,
+ "end": 126,
+ "ctxt": 0
+ },
+ "tagName": "html",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "attributes": [],
+ "children": [
+ {
+ "type": "Element",
+ "span": {
+ "start": 0,
+ "end": 7,
+ "ctxt": 0
+ },
+ "tagName": "head",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "attributes": [],
+ "children": [],
+ "content": null
+ },
+ {
+ "type": "Element",
+ "span": {
+ "start": 1,
+ "end": 126,
+ "ctxt": 0
+ },
+ "tagName": "body",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "attributes": [],
+ "children": [
+ {
+ "type": "Text",
+ "span": {
+ "start": 7,
+ "end": 8,
+ "ctxt": 0
+ },
+ "value": "\n"
+ },
+ {
+ "type": "Element",
+ "span": {
+ "start": 8,
+ "end": 23,
+ "ctxt": 0
+ },
+ "tagName": "template",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "attributes": [],
+ "children": [],
+ "content": {
+ "type": "DocumentFragment",
+ "span": {
+ "start": 8,
+ "end": 23,
+ "ctxt": 0
+ },
+ "children": [
+ {
+ "type": "Element",
+ "span": {
+ "start": 18,
+ "end": 23,
+ "ctxt": 0
+ },
+ "tagName": "col",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "attributes": [],
+ "children": [],
+ "content": null
+ }
+ ]
+ }
+ },
+ {
+ "type": "Text",
+ "span": {
+ "start": 44,
+ "end": 45,
+ "ctxt": 0
+ },
+ "value": "\n"
+ },
+ {
+ "type": "Element",
+ "span": {
+ "start": 45,
+ "end": 60,
+ "ctxt": 0
+ },
+ "tagName": "template",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "attributes": [],
+ "children": [],
+ "content": {
+ "type": "DocumentFragment",
+ "span": {
+ "start": 45,
+ "end": 60,
+ "ctxt": 0
+ },
+ "children": [
+ {
+ "type": "Element",
+ "span": {
+ "start": 55,
+ "end": 60,
+ "ctxt": 0
+ },
+ "tagName": "col",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "attributes": [],
+ "children": [],
+ "content": null
+ }
+ ]
+ }
+ },
+ {
+ "type": "Text",
+ "span": {
+ "start": 87,
+ "end": 88,
+ "ctxt": 0
+ },
+ "value": "\n"
+ },
+ {
+ "type": "Element",
+ "span": {
+ "start": 88,
+ "end": 103,
+ "ctxt": 0
+ },
+ "tagName": "template",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "attributes": [],
+ "children": [],
+ "content": {
+ "type": "DocumentFragment",
+ "span": {
+ "start": 88,
+ "end": 103,
+ "ctxt": 0
+ },
+ "children": [
+ {
+ "type": "Element",
+ "span": {
+ "start": 98,
+ "end": 103,
+ "ctxt": 0
+ },
+ "tagName": "col",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "attributes": [],
+ "children": [],
+ "content": null
+ }
+ ]
+ }
+ },
+ {
+ "type": "Text",
+ "span": {
+ "start": 125,
+ "end": 126,
+ "ctxt": 0
+ },
+ "value": "\n"
+ }
+ ],
+ "content": null
+ }
+ ],
+ "content": null
+ }
+ ]
+}
diff --git a/crates/swc_html_parser/tests/recovery/element/colgroup-1/output.stderr b/crates/swc_html_parser/tests/recovery/element/colgroup-1/output.stderr
new file mode 100644
index 00000000000..ea7795b3dbf
--- /dev/null
+++ b/crates/swc_html_parser/tests/recovery/element/colgroup-1/output.stderr
@@ -0,0 +1,36 @@
+
+ x Start tag seen without seeing a doctype firs, expected ""
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:1:1]
+ 1 |
+ : ^^^^^^
+ `----
+
+ x Garbage in "colgroup" element
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:2:1]
+ 2 |
+ : ^^^^^^^^^^
+ `----
+
+ x Garbage in "colgroup" element
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:3:1]
+ 3 |
+ : ^^^^^^^^^^
+ `----
+
+ x Garbage in "colgroup" element
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:3:1]
+ 3 |
+ : ^^^^^^
+ `----
+
+ x Garbage in "colgroup" element
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:4:1]
+ 4 | A
+ : ^^^^^^^^^^
+ `----
+
+ x Non-space character in "colgroup" element
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:4:1]
+ 4 | A
+ : ^
+ `----
diff --git a/crates/swc_html_parser/tests/recovery/element/colgroup-1/span.rust-debug b/crates/swc_html_parser/tests/recovery/element/colgroup-1/span.rust-debug
new file mode 100644
index 00000000000..3db5f55c7d3
--- /dev/null
+++ b/crates/swc_html_parser/tests/recovery/element/colgroup-1/span.rust-debug
@@ -0,0 +1,181 @@
+
+ x Document
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:1:1]
+ 1 | ,->
+ 2 | |
+ 3 | |
+ 4 | | A
+ 5 | `->
+ `----
+
+ x Child
+
+ x Element
+
+ x Child
+
+ x Element
+
+ x Child
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:1:1]
+ 1 | ,->
+ 2 | |
+ 3 | |
+ 4 | `-> A
+ 5 |
+ `----
+
+ x Element
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:1:1]
+ 1 | ,->
+ 2 | |
+ 3 | |
+ 4 | `-> A
+ 5 |
+ `----
+
+ x Child
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:1:1]
+ 1 |
+ : ^
+ 2 |
+ `----
+
+ x Text
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:1:1]
+ 1 |
+ : ^
+ 2 |
+ `----
+
+ x Child
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:2:1]
+ 2 |
+ : ^^^^^^^^^^^^^^^
+ `----
+
+ x Element
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:2:1]
+ 2 |
+ : ^^^^^^^^^^^^^^^
+ `----
+
+ x DocumentFragment
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:2:1]
+ 2 |
+ : ^^^^^^^^^^^^^^^
+ `----
+
+ x Child
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:2:1]
+ 2 |
+ : ^^^^^
+ `----
+
+ x Element
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:2:1]
+ 2 |
+ : ^^^^^
+ `----
+
+ x Child
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:2:1]
+ 2 |
+ : ^
+ 3 |
+ `----
+
+ x Text
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:2:1]
+ 2 |
+ : ^
+ 3 |
+ `----
+
+ x Child
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:3:1]
+ 3 |
+ : ^^^^^^^^^^^^^^^
+ `----
+
+ x Element
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:3:1]
+ 3 |
+ : ^^^^^^^^^^^^^^^
+ `----
+
+ x DocumentFragment
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:3:1]
+ 3 |
+ : ^^^^^^^^^^^^^^^
+ `----
+
+ x Child
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:3:1]
+ 3 |
+ : ^^^^^
+ `----
+
+ x Element
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:3:1]
+ 3 |
+ : ^^^^^
+ `----
+
+ x Child
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:3:1]
+ 3 |
+ : ^
+ 4 | A
+ `----
+
+ x Text
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:3:1]
+ 3 |
+ : ^
+ 4 | A
+ `----
+
+ x Child
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:4:1]
+ 4 | A
+ : ^^^^^^^^^^^^^^^
+ `----
+
+ x Element
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:4:1]
+ 4 | A
+ : ^^^^^^^^^^^^^^^
+ `----
+
+ x DocumentFragment
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:4:1]
+ 4 | A
+ : ^^^^^^^^^^^^^^^
+ `----
+
+ x Child
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:4:1]
+ 4 | A
+ : ^^^^^
+ `----
+
+ x Element
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:4:1]
+ 4 | A
+ : ^^^^^
+ `----
+
+ x Child
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:4:1]
+ 4 | A
+ : ^
+ 5 |
+ `----
+
+ x Text
+ ,-[$DIR/tests/recovery/element/colgroup-1/input.html:4:1]
+ 4 | A
+ : ^
+ 5 |
+ `----
diff --git a/crates/swc_html_parser/tests/recovery/element/colgroup/output.stderr b/crates/swc_html_parser/tests/recovery/element/colgroup/output.stderr
index fa7fe837748..8e93f875a23 100644
--- a/crates/swc_html_parser/tests/recovery/element/colgroup/output.stderr
+++ b/crates/swc_html_parser/tests/recovery/element/colgroup/output.stderr
@@ -1,11 +1,5 @@
- x Unexpected token
- ,-[$DIR/tests/recovery/element/colgroup/input.html:10:9]
- 10 |
- : ^^^^^^
- `----
-
- x Stray end tag ""
+ x Stray end tag "div"
,-[$DIR/tests/recovery/element/colgroup/input.html:10:9]
10 |
: ^^^^^^
diff --git a/crates/swc_html_parser/tests/recovery/element/embed-closed/output.stderr b/crates/swc_html_parser/tests/recovery/element/embed-closed/output.stderr
index 3fa80227d11..e25ffa04670 100644
--- a/crates/swc_html_parser/tests/recovery/element/embed-closed/output.stderr
+++ b/crates/swc_html_parser/tests/recovery/element/embed-closed/output.stderr
@@ -1,5 +1,5 @@
- x Unexpected token
+ x Stray end tag "embed"
,-[$DIR/tests/recovery/element/embed-closed/input.html:11:1]
11 |
: ^^^^^^^^
diff --git a/crates/swc_html_parser/tests/recovery/element/font/output.stderr b/crates/swc_html_parser/tests/recovery/element/font/output.stderr
index 26e40c9db5f..5addfc705cb 100644
--- a/crates/swc_html_parser/tests/recovery/element/font/output.stderr
+++ b/crates/swc_html_parser/tests/recovery/element/font/output.stderr
@@ -1,14 +1,14 @@
- x Missing doctype
+ x Start tag seen without seeing a doctype firs, expected ""
,-[$DIR/tests/recovery/element/font/input.html:1:1]
1 | X
: ^^^
`----
- x End tag "
" implied, but there were open elements
+ x End tag "p" implied, but there were open elements
,-[$DIR/tests/recovery/element/font/input.html:1:1]
1 | X
- : ^^^^^^^^^^^^^^^^
+ : ^^^
`----
- x Unexpected end of file
+ x End of file seen and there were open elements
diff --git a/crates/swc_html_parser/tests/recovery/element/foreign-context/output.stderr b/crates/swc_html_parser/tests/recovery/element/foreign-context/output.stderr
index cb0a1ce5dd1..f6a1e76c98b 100644
--- a/crates/swc_html_parser/tests/recovery/element/foreign-context/output.stderr
+++ b/crates/swc_html_parser/tests/recovery/element/foreign-context/output.stderr
@@ -1,22 +1,16 @@
- x Unexpected HTML end tag "
" in a foreign namespace context
+ x End tag "p" did not match the name of the current open element ("svg")
,-[$DIR/tests/recovery/element/foreign-context/input.html:11:1]
11 |
: ^^^^
`----
- x No "p" element in scope but a "" end tag seen
+ x No "p" element in scope but a "p" end tag seen
,-[$DIR/tests/recovery/element/foreign-context/input.html:11:1]
11 |
: ^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:11:1]
- 11 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:11:1]
11 |
@@ -29,24 +23,24 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML end tag "" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:11:1]
+ 11 |
+ : ^^^^^^^^^^^
+ `----
+
+ x End tag "br" did not match the name of the current open element ("svg")
,-[$DIR/tests/recovery/element/foreign-context/input.html:12:1]
12 |
: ^^^^^
`----
- x Unexpected end tag ""
+ x End tag "br"
,-[$DIR/tests/recovery/element/foreign-context/input.html:12:1]
12 |
: ^^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:12:1]
- 12 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:12:1]
12 |
@@ -59,18 +53,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:12:1]
+ 12 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "b" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:13:1]
13 |
: ^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:13:1]
- 13 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:13:1]
13 |
@@ -83,18 +77,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:13:1]
+ 13 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "big" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:14:1]
14 |
: ^^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:14:1]
- 14 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:14:1]
14 |
@@ -107,18 +101,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:14:1]
+ 14 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "blockquote" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:15:1]
15 |
: ^^^^^^^^^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:15:1]
- 15 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:15:1]
15 |
@@ -131,18 +125,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:15:1]
+ 15 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "br" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:16:1]
16 |
: ^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:16:1]
- 16 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:16:1]
16 |
@@ -155,18 +149,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:16:1]
+ 16 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "center" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:17:1]
17 |
: ^^^^^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:17:1]
- 17 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:17:1]
17 |
@@ -179,18 +173,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:17:1]
+ 17 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "code" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:18:1]
18 |
: ^^^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:18:1]
- 18 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:18:1]
18 |
@@ -203,18 +197,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:18:1]
+ 18 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "dd" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:19:1]
19 |
: ^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:19:1]
- 19 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:19:1]
19 |
@@ -227,18 +221,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:19:1]
+ 19 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "div" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:20:1]
20 |
: ^^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:20:1]
- 20 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:20:1]
20 |
@@ -251,18 +245,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:20:1]
+ 20 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "dl" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:21:1]
21 |
: ^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:21:1]
- 21 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:21:1]
21 |
@@ -275,18 +269,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:21:1]
+ 21 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "dt" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:22:1]
22 |
: ^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:22:1]
- 22 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:22:1]
22 |
@@ -299,18 +293,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:22:1]
+ 22 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "em" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:23:1]
23 |
: ^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:23:1]
- 23 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:23:1]
23 |
@@ -323,18 +317,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:23:1]
+ 23 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "embed" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:24:1]
24 |
: ^^^^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:24:1]
- 24 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:24:1]
24 |
@@ -347,18 +341,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:24:1]
+ 24 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "h1" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:25:1]
25 |
: ^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:25:1]
- 25 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:25:1]
25 |
@@ -371,18 +365,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:25:1]
+ 25 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "h2" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:26:1]
26 |
: ^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:26:1]
- 26 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:26:1]
26 |
@@ -395,18 +389,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:26:1]
+ 26 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "h3" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:27:1]
27 |
: ^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:27:1]
- 27 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:27:1]
27 |
@@ -419,18 +413,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:27:1]
+ 27 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "h4" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:28:1]
28 |
: ^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:28:1]
- 28 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:28:1]
28 |
@@ -443,18 +437,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:28:1]
+ 28 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "h5" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:29:1]
29 |
: ^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:29:1]
- 29 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:29:1]
29 |
@@ -467,18 +461,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:29:1]
+ 29 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "h6" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:30:1]
30 |
: ^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:30:1]
- 30 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:30:1]
30 |
@@ -491,18 +485,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:30:1]
+ 30 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "hr" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:31:1]
31 |
: ^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:31:1]
- 31 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:31:1]
31 |
@@ -515,18 +509,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:31:1]
+ 31 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "i" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:32:1]
32 |
: ^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:32:1]
- 32 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:32:1]
32 |
@@ -539,18 +533,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:32:1]
+ 32 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "img" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:33:1]
33 |
: ^^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:33:1]
- 33 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:33:1]
33 |
@@ -563,18 +557,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:33:1]
+ 33 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "li" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:34:1]
34 |
: ^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:34:1]
- 34 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:34:1]
34 |
@@ -587,7 +581,13 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:34:1]
+ 34 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "listing" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:35:1]
35 |
: ^^^^^^^^^
@@ -605,24 +605,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected token
+ x Stray end tag "svg<"
,-[$DIR/tests/recovery/element/foreign-context/input.html:35:1]
35 |
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x HTML start tag "menu" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:36:1]
36 |
: ^^^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:36:1]
- 36 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:36:1]
36 |
@@ -635,18 +629,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:36:1]
+ 36 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "meta" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:37:1]
37 |
: ^^^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:37:1]
- 37 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:37:1]
37 |
@@ -659,18 +653,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:37:1]
+ 37 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "nobr" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:38:1]
38 |
: ^^^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:38:1]
- 38 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:38:1]
38 |
@@ -683,18 +677,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:38:1]
+ 38 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "ol" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:39:1]
39 |
: ^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:39:1]
- 39 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:39:1]
39 |
@@ -707,18 +701,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:39:1]
+ 39 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "p" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:40:1]
40 |
: ^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:40:1]
- 40 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:40:1]
40 |
@@ -731,7 +725,13 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:40:1]
+ 40 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "pre" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:41:1]
41 |
: ^^^^^
@@ -749,24 +749,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected token
+ x Stray end tag "svg<"
,-[$DIR/tests/recovery/element/foreign-context/input.html:41:1]
41 |
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x HTML start tag "ruby" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:42:1]
42 |
: ^^^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:42:1]
- 42 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:42:1]
42 |
@@ -779,18 +773,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:42:1]
+ 42 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "s" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:43:1]
43 |
: ^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:43:1]
- 43 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:43:1]
43 |
@@ -803,18 +797,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:43:1]
+ 43 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "small" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:44:1]
44 |
: ^^^^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:44:1]
- 44 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:44:1]
44 |
@@ -827,18 +821,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:44:1]
+ 44 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "span" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:45:1]
45 |
: ^^^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:45:1]
- 45 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:45:1]
45 |
@@ -851,18 +845,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:45:1]
+ 45 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "strong" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:46:1]
46 |
: ^^^^^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:46:1]
- 46 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:46:1]
46 |
@@ -875,18 +869,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:46:1]
+ 46 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "strike" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:47:1]
47 |
: ^^^^^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:47:1]
- 47 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:47:1]
47 |
@@ -899,18 +893,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:47:1]
+ 47 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "sub" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:48:1]
48 |
: ^^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:48:1]
- 48 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:48:1]
48 |
@@ -923,18 +917,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:48:1]
+ 48 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "sup" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:49:1]
49 |
: ^^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:49:1]
- 49 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:49:1]
49 |
@@ -947,18 +941,18 @@
: ^^^^^^^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:49:1]
+ 49 |
+ : ^^^^^^^^^^^
+ `----
+
+ x HTML start tag "table" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:50:1]
50 |
: ^^^^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:50:1]
- 50 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:50:1]
50 |
@@ -971,36 +965,36 @@
: ^^^^^^^^^^^
`----
- x Unexpected token
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:50:1]
+ 50 |
+ : ^^^^^^^^^^^
+ `----
+
+ x Start tag "div" seen in "table"
,-[$DIR/tests/recovery/element/foreign-context/input.html:51:1]
51 |
: ^^^^^
`----
- x Unexpected token
+ x Start tag "svg" seen in "table"
,-[$DIR/tests/recovery/element/foreign-context/input.html:51:1]
51 |
: ^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x HTML start tag "tt" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:51:1]
51 |
: ^^^^
`----
- x Unexpected token
+ x Start tag "tt" seen in "table"
,-[$DIR/tests/recovery/element/foreign-context/input.html:51:1]
51 |
: ^^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:51:1]
- 51 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:51:1]
51 |
@@ -1013,43 +1007,43 @@
: ^^^^^^^^^^^
`----
- x Unexpected token
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:51:1]
+ 51 |
+ : ^^^^^^^^^^^
+ `----
+
+ x Misplaced non-space characters inside a table
,-[$DIR/tests/recovery/element/foreign-context/input.html:51:1]
51 |
: ^
52 |
`----
- x Unexpected token
+ x Start tag "div" seen in "table"
,-[$DIR/tests/recovery/element/foreign-context/input.html:52:1]
52 |
: ^^^^^
`----
- x Unexpected token
+ x Start tag "svg" seen in "table"
,-[$DIR/tests/recovery/element/foreign-context/input.html:52:1]
52 |
: ^^^^^
`----
- x Unexpected HTML start tag "
" in a foreign namespace context
+ x HTML start tag "u" in a foreign namespace context
,-[$DIR/tests/recovery/element/foreign-context/input.html:52:1]
52 |
: ^^^
`----
- x Unexpected token
+ x Start tag "u" seen in "table"
,-[$DIR/tests/recovery/element/foreign-context/input.html:52:1]
52 |
: ^^^
`----
- x Unexpected token
- ,-[$DIR/tests/recovery/element/foreign-context/input.html:52:1]
- 52 |
- : ^^^^^^^^^^^
- `----
-
x Unexpected solidus in tag
,-[$DIR/tests/recovery/element/foreign-context/input.html:52:1]
52 |
@@ -1062,43 +1056,43 @@
: ^^^^^^^^^^^
`----
- x Unexpected token
+ x Stray end tag "svg<"
+ ,-[$DIR/tests/recovery/element/foreign-context/input.html:52:1]
+ 52 |
+ : ^^^^^^^^^^^
+ `----
+
+ x Misplaced non-space characters inside a table
,-[$DIR/tests/recovery/element/foreign-context/input.html:52:1]
52 |
: ^
53 |
`----
- x Unexpected token
+ x Start tag "div" seen in "table"
,-[$DIR/tests/recovery/element/foreign-context/input.html:53:1]
53 |
: ^^^^^
`----
- x Unexpected token
+ x Start tag "svg" seen in "table"
,-[$DIR/tests/recovery/element/foreign-context/input.html:53:1]
53 |
: ^^^^^
`----
- x Unexpected HTML start tag "
: ^^^^^^^
diff --git a/crates/swc_html_parser/tests/recovery/element/body-3/output.stderr b/crates/swc_html_parser/tests/recovery/element/body-3/output.stderr
index 01e7f30aad3..0c9a9f8ca18 100644
--- a/crates/swc_html_parser/tests/recovery/element/body-3/output.stderr
+++ b/crates/swc_html_parser/tests/recovery/element/body-3/output.stderr
@@ -1,8 +1,8 @@
- x Stray start tag "
: ^^^^^^
diff --git a/crates/swc_html_parser/tests/recovery/element/body/broken/output.stderr b/crates/swc_html_parser/tests/recovery/element/body/broken/output.stderr
index 07b0903b2fc..9f815cc49b8 100644
--- a/crates/swc_html_parser/tests/recovery/element/body/broken/output.stderr
+++ b/crates/swc_html_parser/tests/recovery/element/body/broken/output.stderr
@@ -1,5 +1,5 @@
- x Stray start tag ""
+ x Stray start tag "html"
,-[$DIR/tests/recovery/element/body/broken/input.html:6:1]
6 |
: ^^^^^^^^^^^^^^^^^^
diff --git a/crates/swc_html_parser/tests/recovery/element/br/self-closing/output.stderr b/crates/swc_html_parser/tests/recovery/element/br/self-closing/output.stderr
index bb54db85d6e..4b4fc75bfbb 100644
--- a/crates/swc_html_parser/tests/recovery/element/br/self-closing/output.stderr
+++ b/crates/swc_html_parser/tests/recovery/element/br/self-closing/output.stderr
@@ -1,18 +1,18 @@
- x Unexpected end tag ""
+ x End tag "br"
,-[$DIR/tests/recovery/element/br/self-closing/input.html:11:5]
11 | testtest
: ^^^^^
`----
- x Unexpected end tag ""
- ,-[$DIR/tests/recovery/element/br/self-closing/input.html:12:5]
- 12 | testtest
- : ^^^^^^
- `----
-
x End tag with trailing solidus
,-[$DIR/tests/recovery/element/br/self-closing/input.html:12:5]
12 | testtest
: ^^^^^^
`----
+
+ x End tag "br"
+ ,-[$DIR/tests/recovery/element/br/self-closing/input.html:12:5]
+ 12 | testtest
+ : ^^^^^^
+ `----
diff --git a/crates/swc_html_parser/tests/recovery/element/broken-end-tags/output.stderr b/crates/swc_html_parser/tests/recovery/element/broken-end-tags/output.stderr
index a2bc4b7fe1b..591e16ca4af 100644
--- a/crates/swc_html_parser/tests/recovery/element/broken-end-tags/output.stderr
+++ b/crates/swc_html_parser/tests/recovery/element/broken-end-tags/output.stderr
@@ -1,5 +1,5 @@
- x Missing doctype
+ x Start tag seen without seeing a doctype firs, expected ""
,-[$DIR/tests/recovery/element/broken-end-tags/input.html:1:1]
1 |
: ^^^^^
diff --git a/crates/swc_html_parser/tests/recovery/element/colgroup-1/dom.rust-debug b/crates/swc_html_parser/tests/recovery/element/colgroup-1/dom.rust-debug
new file mode 100644
index 00000000000..211de6020ea
--- /dev/null
+++ b/crates/swc_html_parser/tests/recovery/element/colgroup-1/dom.rust-debug
@@ -0,0 +1,20 @@
+|
+|