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 \"\" open", - tag_name - ) - .into(), - ErrorKind::UnexpectedEndTagWithSelectOpen(tag_name) => format!( - "Unexpected end tag \"\" with \"--> : ^^^^^^^^^^ `---- - x Unexpected token + x Stray end tag "textarea" ,-[$DIR/tests/recovery/comment/inside-textarea/input.html:1:1] 1 | --> : ^^^^^^^^^^^ diff --git a/crates/swc_html_parser/tests/recovery/doctype/eof/output.stderr b/crates/swc_html_parser/tests/recovery/doctype/eof/output.stderr index 289db339849..815b827bd55 100644 --- a/crates/swc_html_parser/tests/recovery/doctype/eof/output.stderr +++ b/crates/swc_html_parser/tests/recovery/doctype/eof/output.stderr @@ -1,12 +1,12 @@ - x Non conforming doctype - ,-[$DIR/tests/recovery/doctype/eof/input.html:1:1] - 1 | > - `---- - x Missing doctype name ,-[$DIR/tests/recovery/doctype/no-doctype-name-line/input.html:1:1] 1 | ,-> > `---- + + x Non conforming doctype + ,-[$DIR/tests/recovery/doctype/no-doctype-name-line/input.html:1:1] + 1 | ,-> > + `---- diff --git a/crates/swc_html_parser/tests/recovery/doctype/no-doctype-name-space/output.stderr b/crates/swc_html_parser/tests/recovery/doctype/no-doctype-name-space/output.stderr index 21ecca25e91..94508641081 100644 --- a/crates/swc_html_parser/tests/recovery/doctype/no-doctype-name-space/output.stderr +++ b/crates/swc_html_parser/tests/recovery/doctype/no-doctype-name-space/output.stderr @@ -1,12 +1,12 @@ - x Non conforming doctype - ,-[$DIR/tests/recovery/doctype/no-doctype-name-space/input.html:1:1] - 1 | - : ^^^^^^^^^^^ - `---- - x Missing doctype name ,-[$DIR/tests/recovery/doctype/no-doctype-name-space/input.html:1:1] 1 | : ^^^^^^^^^^^ `---- + + x Non conforming doctype + ,-[$DIR/tests/recovery/doctype/no-doctype-name-space/input.html:1:1] + 1 | + : ^^^^^^^^^^^ + `---- diff --git a/crates/swc_html_parser/tests/recovery/document_type/bogus/output.stderr b/crates/swc_html_parser/tests/recovery/document_type/bogus/output.stderr index 6e264cb4a0e..b033687414d 100644 --- a/crates/swc_html_parser/tests/recovery/document_type/bogus/output.stderr +++ b/crates/swc_html_parser/tests/recovery/document_type/bogus/output.stderr @@ -1,12 +1,12 @@ - x Non conforming doctype - ,-[$DIR/tests/recovery/document_type/bogus/input.html:1:1] - 1 | - : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - `---- - x Missing quote before doctype system identifier ,-[$DIR/tests/recovery/document_type/bogus/input.html:1:1] 1 | : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- + + x Non conforming doctype + ,-[$DIR/tests/recovery/document_type/bogus/input.html:1:1] + 1 | + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- diff --git a/crates/swc_html_parser/tests/recovery/document_type/missing-name/output.stderr b/crates/swc_html_parser/tests/recovery/document_type/missing-name/output.stderr index c79f514b430..48aee3065b3 100644 --- a/crates/swc_html_parser/tests/recovery/document_type/missing-name/output.stderr +++ b/crates/swc_html_parser/tests/recovery/document_type/missing-name/output.stderr @@ -1,12 +1,12 @@ - x Non conforming doctype - ,-[$DIR/tests/recovery/document_type/missing-name/input.html:1:1] - 1 | - : ^^^^^^^^^^ - `---- - x Missing doctype name ,-[$DIR/tests/recovery/document_type/missing-name/input.html:1:1] 1 | : ^^^^^^^^^^ `---- + + x Non conforming doctype + ,-[$DIR/tests/recovery/document_type/missing-name/input.html:1:1] + 1 | + : ^^^^^^^^^^ + `---- diff --git a/crates/swc_html_parser/tests/recovery/document_type/unknown/output.stderr b/crates/swc_html_parser/tests/recovery/document_type/unknown/output.stderr index 74d0379c1e3..3fccd96c436 100644 --- a/crates/swc_html_parser/tests/recovery/document_type/unknown/output.stderr +++ b/crates/swc_html_parser/tests/recovery/document_type/unknown/output.stderr @@ -1,12 +1,12 @@ - x Non conforming doctype - ,-[$DIR/tests/recovery/document_type/unknown/input.html:1:1] - 1 | Hello - : ^^^^^^^^^^^ - `---- - x Missing doctype name ,-[$DIR/tests/recovery/document_type/unknown/input.html:1:1] 1 | Hello : ^^^^^^^^^^^ `---- + + x Non conforming doctype + ,-[$DIR/tests/recovery/document_type/unknown/input.html:1:1] + 1 | Hello + : ^^^^^^^^^^^ + `---- diff --git a/crates/swc_html_parser/tests/recovery/element/a-1/output.stderr b/crates/swc_html_parser/tests/recovery/element/a-1/output.stderr index f9f416b6269..ea10e36f8ae 100644 --- a/crates/swc_html_parser/tests/recovery/element/a-1/output.stderr +++ b/crates/swc_html_parser/tests/recovery/element/a-1/output.stderr @@ -1,11 +1,11 @@ - x Missing doctype + x Start tag seen without seeing a doctype firs, expected "" ,-[$DIR/tests/recovery/element/a-1/input.html:1:1] 1 | 1

23

: ^^^ `---- - x Unexpected token + x End tag "a" violates nesting rules ,-[$DIR/tests/recovery/element/a-1/input.html:1:1] 1 | 1

23

: ^^^^ diff --git a/crates/swc_html_parser/tests/recovery/element/a-2/output.stderr b/crates/swc_html_parser/tests/recovery/element/a-2/output.stderr index 678f352d5ed..4cf4900aeb3 100644 --- a/crates/swc_html_parser/tests/recovery/element/a-2/output.stderr +++ b/crates/swc_html_parser/tests/recovery/element/a-2/output.stderr @@ -1,11 +1,11 @@ - x Missing doctype + x Start tag seen without seeing a doctype firs, expected "" ,-[$DIR/tests/recovery/element/a-2/input.html:1:1] 1 | 1 : ^^^ `---- - x Unexpected token + x End tag "a" violates nesting rules ,-[$DIR/tests/recovery/element/a-2/input.html:1:1] 1 | 1 : ^^^^ diff --git a/crates/swc_html_parser/tests/recovery/element/a-3/output.stderr b/crates/swc_html_parser/tests/recovery/element/a-3/output.stderr index f6c426fc881..9d83859199c 100644 --- a/crates/swc_html_parser/tests/recovery/element/a-3/output.stderr +++ b/crates/swc_html_parser/tests/recovery/element/a-3/output.stderr @@ -1,11 +1,11 @@ - x Missing doctype + x Start tag seen without seeing a doctype firs, expected "" ,-[$DIR/tests/recovery/element/a-3/input.html:1:1] 1 | 1
2
34
5
: ^^^ `---- - x Unexpected token + x End tag "a" violates nesting rules ,-[$DIR/tests/recovery/element/a-3/input.html:1:1] 1 | 1
2
34
5
: ^^^^ diff --git a/crates/swc_html_parser/tests/recovery/element/a-4/output.stderr b/crates/swc_html_parser/tests/recovery/element/a-4/output.stderr index cc4b6a79ece..87380e8f39f 100644 --- a/crates/swc_html_parser/tests/recovery/element/a-4/output.stderr +++ b/crates/swc_html_parser/tests/recovery/element/a-4/output.stderr @@ -1,50 +1,56 @@ - x Missing doctype + x Start tag seen without seeing a doctype firs, expected "" ,-[$DIR/tests/recovery/element/a-4/input.html:1:1] 1 | 1

23

: ^^^^^^^ `---- - x Unexpected token + x Start tag "a" seen in "table" ,-[$DIR/tests/recovery/element/a-4/input.html:1:1] 1 |
1

23

: ^^^ `---- - x Unexpected token + x Misplaced non-space characters inside a table ,-[$DIR/tests/recovery/element/a-4/input.html:1:1] 1 |
1

23

: ^ `---- - x Unexpected token + x Start tag "p" seen in "table" ,-[$DIR/tests/recovery/element/a-4/input.html:1:1] 1 |
1

23

: ^^^ `---- - x Unexpected token + x Misplaced non-space characters inside a table ,-[$DIR/tests/recovery/element/a-4/input.html:1:1] 1 |
1

23

: ^ `---- - x Unexpected token + x Stray end tag "a" ,-[$DIR/tests/recovery/element/a-4/input.html:1:1] 1 |
1

23

: ^^^^ `---- - x Unexpected token + x End tag "a" violates nesting rules + ,-[$DIR/tests/recovery/element/a-4/input.html:1:1] + 1 |
1

23

+ : ^^^^ + `---- + + x Misplaced non-space characters inside a table ,-[$DIR/tests/recovery/element/a-4/input.html:1:1] 1 |
1

23

: ^ `---- - x Unexpected token + x Stray end tag "p" ,-[$DIR/tests/recovery/element/a-4/input.html:1:1] 1 |
1

23

: ^^^^ `---- - 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/a/output.stderr b/crates/swc_html_parser/tests/recovery/element/a/output.stderr index 958dc807f70..438dae62bb4 100644 --- a/crates/swc_html_parser/tests/recovery/element/a/output.stderr +++ b/crates/swc_html_parser/tests/recovery/element/a/output.stderr @@ -1,11 +1,11 @@ - x Missing doctype + x Start tag seen without seeing a doctype firs, expected "" ,-[$DIR/tests/recovery/element/a/input.html:1:1] 1 |

: ^^^ `---- - x Unexpected token + x End tag "a" violates nesting rules ,-[$DIR/tests/recovery/element/a/input.html:1:1] 1 |

: ^^^^ diff --git a/crates/swc_html_parser/tests/recovery/element/applet-2/output.stderr b/crates/swc_html_parser/tests/recovery/element/applet-2/output.stderr index a86e7b04c34..e57fc2f8a2c 100644 --- a/crates/swc_html_parser/tests/recovery/element/applet-2/output.stderr +++ b/crates/swc_html_parser/tests/recovery/element/applet-2/output.stderr @@ -1,8 +1,8 @@ - x Missing doctype + x Start tag seen without seeing a doctype firs, expected "" ,-[$DIR/tests/recovery/element/applet-2/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/applet/output.stderr b/crates/swc_html_parser/tests/recovery/element/applet/output.stderr index 9bc36bacad4..4123fe2fe3d 100644 --- a/crates/swc_html_parser/tests/recovery/element/applet/output.stderr +++ b/crates/swc_html_parser/tests/recovery/element/applet/output.stderr @@ -1,14 +1,14 @@ - x Missing doctype + x Start tag seen without seeing a doctype firs, expected "" ,-[$DIR/tests/recovery/element/applet/input.html:1:1] 1 | x : ^^^ `---- - x Unexpected token + x No "b" element in scope but a "b" end tag seen ,-[$DIR/tests/recovery/element/applet/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/b-1/output.stderr b/crates/swc_html_parser/tests/recovery/element/b-1/output.stderr index 0bc986ff02e..b42a77d901a 100644 --- a/crates/swc_html_parser/tests/recovery/element/b-1/output.stderr +++ b/crates/swc_html_parser/tests/recovery/element/b-1/output.stderr @@ -1,5 +1,5 @@ - x Unexpected token + x End tag "b" violates nesting rules ,-[$DIR/tests/recovery/element/b-1/input.html:7:1] 7 |

12345

: ^^^^ diff --git a/crates/swc_html_parser/tests/recovery/element/b-2/output.stderr b/crates/swc_html_parser/tests/recovery/element/b-2/output.stderr index 8590d7cc8ce..c7ed8d2c7d3 100644 --- a/crates/swc_html_parser/tests/recovery/element/b-2/output.stderr +++ b/crates/swc_html_parser/tests/recovery/element/b-2/output.stderr @@ -1,11 +1,11 @@ - x Missing doctype + x Start tag seen without seeing a doctype firs, expected "" ,-[$DIR/tests/recovery/element/b-2/input.html:1:1] 1 |

Bold Not bold

: ^^^ `---- - x Unexpected token + x End tag "b" violates nesting rules ,-[$DIR/tests/recovery/element/b-2/input.html:1:1] 1 |

Bold Not bold

: ^^^^ diff --git a/crates/swc_html_parser/tests/recovery/element/b-3/output.stderr b/crates/swc_html_parser/tests/recovery/element/b-3/output.stderr index 0b52cd39d66..96e45fb7044 100644 --- a/crates/swc_html_parser/tests/recovery/element/b-3/output.stderr +++ b/crates/swc_html_parser/tests/recovery/element/b-3/output.stderr @@ -1,14 +1,14 @@ - x Missing doctype + x Start tag seen without seeing a doctype firs, expected "" ,-[$DIR/tests/recovery/element/b-3/input.html:1:1] 1 |

: ^^^ `---- - x Unexpected token + x End tag "a" violates nesting rules ,-[$DIR/tests/recovery/element/b-3/input.html:1:1] 1 |

: ^^^^ `---- - 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/b/output.stderr b/crates/swc_html_parser/tests/recovery/element/b/output.stderr index 6f8678a4128..e8c06228a67 100644 --- a/crates/swc_html_parser/tests/recovery/element/b/output.stderr +++ b/crates/swc_html_parser/tests/recovery/element/b/output.stderr @@ -1,11 +1,11 @@ - x Missing doctype + x Start tag seen without seeing a doctype firs, expected "" ,-[$DIR/tests/recovery/element/b/input.html:1:1] 1 | 1

23

: ^^^ `---- - x Unexpected token + x End tag "b" violates nesting rules ,-[$DIR/tests/recovery/element/b/input.html:1:1] 1 | 1

23

: ^^^^ diff --git a/crates/swc_html_parser/tests/recovery/element/body-1/output.stderr b/crates/swc_html_parser/tests/recovery/element/body-1/output.stderr index 5d093332bc8..b19cb25b0c4 100644 --- a/crates/swc_html_parser/tests/recovery/element/body-1/output.stderr +++ b/crates/swc_html_parser/tests/recovery/element/body-1/output.stderr @@ -1,5 +1,5 @@ - x Unexpected end tag for "", but there were unclosed elements + x Unexpected end tag for "body", but there were unclosed elements ,-[$DIR/tests/recovery/element/body-1/input.html:9:1] 9 | : ^^^^^^^ 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 "
" + x Stray start tag "div" ,-[$DIR/tests/recovery/element/body-3/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/body-4/output.stderr b/crates/swc_html_parser/tests/recovery/element/body-4/output.stderr index 39cf44bddf6..3d2053ab09e 100644 --- a/crates/swc_html_parser/tests/recovery/element/body-4/output.stderr +++ b/crates/swc_html_parser/tests/recovery/element/body-4/output.stderr @@ -5,7 +5,7 @@ : ^^^^^^ `---- - x Stray end tag "
" + x Stray end tag "div" ,-[$DIR/tests/recovery/element/body-4/input.html:1:1] 1 | X
: ^^^^^^ 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 | test
test : ^^^^^ `---- - x Unexpected end tag "
" - ,-[$DIR/tests/recovery/element/br/self-closing/input.html:12:5] - 12 | test
test - : ^^^^^^ - `---- - x End tag with trailing solidus ,-[$DIR/tests/recovery/element/br/self-closing/input.html:12:5] 12 | test
test : ^^^^^^ `---- + + x End tag "br" + ,-[$DIR/tests/recovery/element/br/self-closing/input.html:12:5] + 12 | test
test + : ^^^^^^ + `---- 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 @@ +| +| +| +| " +" +|