mirror of
https://github.com/swc-project/swc.git
synced 2024-10-05 12:49:21 +03:00
feat(html/parser): Improve error reporting (#4740)
This commit is contained in:
parent
f2bbbc232e
commit
51f4cea103
@ -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 \"<select>\" 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 \"</head>\" and \"<body>\"",
|
||||
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 \"<table>\" seen but the previous \"<table>\" is still open".into()
|
||||
}
|
||||
ErrorKind::UnexpectedStartTagInTable(tag_name) => format!(
|
||||
"Unexpected start tag \"<{}>\" seen in \"<table>\"",
|
||||
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 \"<form>\" start tag, but there was already an \
|
||||
active \"<form>\" element, nested forms are not \
|
||||
allowed."
|
||||
.into(),
|
||||
ErrorKind::UnexpectedImageStartTag => {
|
||||
"Unexpected \"<image>\" start tag, only \"<img>\" tag exists in HTML".into()
|
||||
}
|
||||
ErrorKind::UnexpectedStartTagWithSelectOpen(tag_name) => format!(
|
||||
"Unexpected start tag \"<{}>\" with \"<select>\" open",
|
||||
tag_name
|
||||
)
|
||||
.into(),
|
||||
ErrorKind::UnexpectedEndTagWithSelectOpen(tag_name) => format!(
|
||||
"Unexpected end tag \"</{}>\" with \"<select>\" open",
|
||||
tag_name
|
||||
)
|
||||
.into(),
|
||||
ErrorKind::UnexpectedStartTagInRuby(tag_name) => format!(
|
||||
"Unexpected start tag \"<{}>\" with \"<ruby>\" open",
|
||||
tag_name
|
||||
)
|
||||
.into(),
|
||||
ErrorKind::NoCellToClose => "No cell to close".into(),
|
||||
ErrorKind::UnexpectedEndTagWithUnclosedElements(tag_name) => format!(
|
||||
"Unexpected end tag for \"</{}>\", but there were unclosed elements",
|
||||
tag_name
|
||||
)
|
||||
.into(),
|
||||
ErrorKind::UnexpectedEof => "Unexpected end of file".into(),
|
||||
ErrorKind::EndTagDidNotMatchCurrentOpenElement(
|
||||
end_tag_name,
|
||||
current_element_tag_name,
|
||||
) => format!(
|
||||
"End tag \"{}\" did not match the name of the current open element (\"{:}\")",
|
||||
end_tag_name, current_element_tag_name
|
||||
)
|
||||
.into(),
|
||||
ErrorKind::NonSpaceCharacterInFrameset => {
|
||||
"Non-space character in \"<frameset>\"".into()
|
||||
}
|
||||
ErrorKind::NonSpaceCharacterAfterFrameset => {
|
||||
"Non-space character after \"<frameset>\"".into()
|
||||
}
|
||||
ErrorKind::NonSpaceCharacterInTrailer => "Non-space character in page trailer".into(),
|
||||
ErrorKind::UnclosedElementsCell => {
|
||||
"A table cell was implicitly closed, but there were open elements".into()
|
||||
}
|
||||
ErrorKind::NonSpaceAfterBody => "Non-space character after body".into(),
|
||||
ErrorKind::EndTagAfterBody => "Saw an end tag after \"body\" had been closed".into(),
|
||||
ErrorKind::NonSpaceInNoscriptInHead => {
|
||||
ErrorKind::StrayDoctype => "Stray doctype".into(),
|
||||
ErrorKind::NonConformingDoctype => "Non conforming doctype".into(),
|
||||
ErrorKind::NonSpaceCharacterInTrailer => "Non-space character in page trailer".into(),
|
||||
ErrorKind::NonSpaceCharacterAfterFrameset => {
|
||||
"Non-space character after \"frameset\"".into()
|
||||
}
|
||||
ErrorKind::NonSpaceCharacterInFrameset => "Non-space character in \"frameset\"".into(),
|
||||
ErrorKind::NonSpaceCharacterAfterBody => "Non-space character after body".into(),
|
||||
ErrorKind::NonSpaceCharacterInColumnGroup => {
|
||||
"Non-space character in \"colgroup\" element".into()
|
||||
}
|
||||
ErrorKind::NonSpaceCharacterInNoscriptInHead => {
|
||||
"Non-space character inside \"noscript\" inside \"head\"".into()
|
||||
}
|
||||
ErrorKind::SomethingBetweenHeadAndBody(tag_name) => {
|
||||
format!("\"{}\" element between \"head\" and \"body\"", tag_name).into()
|
||||
}
|
||||
ErrorKind::StartTagWithoutDoctype => {
|
||||
"Start tag seen without seeing a doctype firs, expected \"<!DOCTYPE html>\"".into()
|
||||
}
|
||||
ErrorKind::StartSelectWhereEndSelectExpected => {
|
||||
"\"select\" start tag where end tag expected".into()
|
||||
}
|
||||
ErrorKind::StartTagWithSelectOpen(tag_name) => {
|
||||
format!("\"{}\" start tag with \"select\" open", tag_name).into()
|
||||
}
|
||||
ErrorKind::BadStartTagInNoscriptInHead(tag_name) => format!(
|
||||
"Bad start tag in \"{}\" in \"noscript\" in \"head\"",
|
||||
tag_name
|
||||
)
|
||||
.into(),
|
||||
ErrorKind::UnexpectedImageStartTag => {
|
||||
"Saw a start tag \"image\", \"img\" element is outdated".into()
|
||||
}
|
||||
ErrorKind::SomethingSeenWhenSomethingOpen(tag_name) => format!(
|
||||
"Start tag \"{}\" seen but an element of the same type was already open",
|
||||
tag_name
|
||||
)
|
||||
.into(),
|
||||
ErrorKind::HeadingWhenHeadingOpen => {
|
||||
"Heading cannot be a child of another heading".into()
|
||||
}
|
||||
ErrorKind::NoCellToClose => "No cell to close".into(),
|
||||
ErrorKind::StartTagInTable(tag_name) => {
|
||||
format!("Start tag \"{}\" seen in \"table\"", tag_name).into()
|
||||
}
|
||||
ErrorKind::FormWhenFormOpen => "Saw a \"form\" start tag, but there was already an \
|
||||
active \"form\" element, nested forms are not allowed"
|
||||
.into(),
|
||||
ErrorKind::TableSeenWhileTableOpen => {
|
||||
"Start tag for \"table\" seen but the previous \"table\" is still open".into()
|
||||
}
|
||||
ErrorKind::StartTagInTableBody(tag_name) => {
|
||||
format!("Start tag \"{}\" seen in \"table\" body", tag_name).into()
|
||||
}
|
||||
ErrorKind::EndTagSeenWithoutDoctype => {
|
||||
"End tag seen without seeing a doctype first, expected \"<!DOCTYPE html>\"".into()
|
||||
}
|
||||
ErrorKind::EndTagAfterBody => "Saw an end tag after \"body\" had been closed".into(),
|
||||
ErrorKind::EndTagSeenWithSelectOpen(tag_name) => {
|
||||
format!("\"{}\" end tag with \"select\" open", tag_name).into()
|
||||
}
|
||||
ErrorKind::GarbageInColumnGroup => "Garbage in \"colgroup\" element".into(),
|
||||
ErrorKind::EndTagBr => "End tag \"br\"".into(),
|
||||
ErrorKind::NoElementToCloseButEndTagSeen(tag_name) => format!(
|
||||
"No \"{}\" element in scope but a \"{}\" end tag seen",
|
||||
tag_name, tag_name
|
||||
)
|
||||
.into(),
|
||||
ErrorKind::HtmlStartTagInForeignContext(tag_name) => format!(
|
||||
"HTML start tag \"{}\" in a foreign namespace context",
|
||||
tag_name
|
||||
)
|
||||
.into(),
|
||||
ErrorKind::NoTableRowToClose => "No table row to close".into(),
|
||||
ErrorKind::NonSpaceCharacterInTable => {
|
||||
"Misplaced non-space characters inside a table".into()
|
||||
}
|
||||
ErrorKind::UnclosedChildrenInRuby => "Unclosed children in \"ruby\"".into(),
|
||||
ErrorKind::StartTagSeenWithoutRuby(tag_name) => format!(
|
||||
"Start tag \"{}\" seen without a \"ruby\" element being open",
|
||||
tag_name
|
||||
)
|
||||
.into(),
|
||||
ErrorKind::UnclosedElementsOnStack => "Unclosed elements on stack".into(),
|
||||
ErrorKind::EndTagDidNotMatchCurrentOpenElement(
|
||||
end_tag_name,
|
||||
current_element_tag_name,
|
||||
) => format!(
|
||||
"End tag \"{}\" did not match the name of the current open element (\"{}\")",
|
||||
end_tag_name, current_element_tag_name
|
||||
)
|
||||
.into(),
|
||||
ErrorKind::EndTagViolatesNestingRules(tag_name) => {
|
||||
format!("End tag \"{}\" violates nesting rules", tag_name).into()
|
||||
}
|
||||
ErrorKind::EofWithUnclosedElements => {
|
||||
"End of file seen and there were open elements".into()
|
||||
}
|
||||
ErrorKind::EndTagWithUnclosedElements(tag_name) => format!(
|
||||
"Unexpected end tag for \"{}\", but there were unclosed elements",
|
||||
tag_name
|
||||
)
|
||||
.into(),
|
||||
ErrorKind::NonSpaceCharacterWithoutDoctype => "Non-space characters found without \
|
||||
seeing a doctype first, expected \
|
||||
\"<!DOCTYPE html>\""
|
||||
.into(),
|
||||
ErrorKind::EofWithoutDoctype => "End of file seen without seeing a doctype first, \
|
||||
expected \"<!DOCTYPE html>\""
|
||||
.into(),
|
||||
ErrorKind::EofInText => "End of file seen when expecting text or an end tag".into(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -267,104 +261,103 @@ impl Error {
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[non_exhaustive]
|
||||
pub enum ErrorKind {
|
||||
// Lexer errors
|
||||
Eof,
|
||||
ControlCharacterInInputStream,
|
||||
NoncharacterInInputStream,
|
||||
SurrogateInInputStream,
|
||||
NonVoidHtmlElementStartTagWithTrailingSolidus,
|
||||
EndTagWithAttributes,
|
||||
EndTagWithTrailingSolidus,
|
||||
UnexpectedSolidusInTag,
|
||||
UnexpectedNullCharacter,
|
||||
UnexpectedQuestionMarkInsteadOfTagName,
|
||||
InvalidFirstCharacterOfTagName,
|
||||
UnexpectedEqualsSignBeforeAttributeName,
|
||||
MissingEndTagName,
|
||||
UnexpectedCharacterInAttributeName,
|
||||
UnknownNamedCharacterReference,
|
||||
MissingSemicolonAfterCharacterReference,
|
||||
UnexpectedCharacterAfterDoctypeSystemIdentifier,
|
||||
UnexpectedCharacterInUnquotedAttributeValue,
|
||||
EofBeforeTagName,
|
||||
EofInTag,
|
||||
MissingAttributeValue,
|
||||
MissingWhitespaceBetweenAttributes,
|
||||
MissingWhitespaceAfterDoctypePublicKeyword,
|
||||
MissingWhitespaceBetweenDoctypePublicAndSystemIdentifiers,
|
||||
MissingWhitespaceAfterDoctypeSystemKeyword,
|
||||
MissingQuoteBeforeDoctypePublicIdentifier,
|
||||
MissingQuoteBeforeDoctypeSystemIdentifier,
|
||||
MissingDoctypePublicIdentifier,
|
||||
MissingDoctypeSystemIdentifier,
|
||||
|
||||
// Lexer errors
|
||||
AbruptClosingOfEmptyComment,
|
||||
AbruptDoctypePublicIdentifier,
|
||||
AbruptDoctypeSystemIdentifier,
|
||||
CdataInHtmlContent,
|
||||
IncorrectlyOpenedComment,
|
||||
EofInScriptHtmlCommentLikeText,
|
||||
EofInDoctype,
|
||||
NestedComment,
|
||||
AbruptClosingOfEmptyComment,
|
||||
EofInComment,
|
||||
IncorrectlyClosedComment,
|
||||
EofInCdata,
|
||||
AbsenceOfDigitsInNumericCharacterReference,
|
||||
CdataInHtmlContent,
|
||||
CharacterReferenceOutsideUnicodeRange,
|
||||
ControlCharacterInInputStream,
|
||||
ControlCharacterReference,
|
||||
EndTagWithAttributes,
|
||||
DuplicateAttribute,
|
||||
EndTagWithTrailingSolidus,
|
||||
EofBeforeTagName,
|
||||
EofInCdata,
|
||||
EofInComment,
|
||||
EofInDoctype,
|
||||
EofInScriptHtmlCommentLikeText,
|
||||
EofInTag,
|
||||
IncorrectlyClosedComment,
|
||||
IncorrectlyOpenedComment,
|
||||
InvalidCharacterSequenceAfterDoctypeName,
|
||||
InvalidFirstCharacterOfTagName,
|
||||
MissingAttributeValue,
|
||||
MissingDoctypeName,
|
||||
MissingDoctypePublicIdentifier,
|
||||
MissingDoctypeSystemIdentifier,
|
||||
MissingEndTagName,
|
||||
MissingQuoteBeforeDoctypePublicIdentifier,
|
||||
MissingQuoteBeforeDoctypeSystemIdentifier,
|
||||
MissingSemicolonAfterCharacterReference,
|
||||
MissingWhitespaceAfterDoctypePublicKeyword,
|
||||
MissingWhitespaceAfterDoctypeSystemKeyword,
|
||||
MissingWhitespaceBeforeDoctypeName,
|
||||
MissingWhitespaceBetweenAttributes,
|
||||
MissingWhitespaceBetweenDoctypePublicAndSystemIdentifiers,
|
||||
NestedComment,
|
||||
NoncharacterCharacterReference,
|
||||
NoncharacterInInputStream,
|
||||
NonVoidHtmlElementStartTagWithTrailingSolidus,
|
||||
NullCharacterReference,
|
||||
SurrogateCharacterReference,
|
||||
CharacterReferenceOutsideUnicodeRange,
|
||||
ControlCharacterReference,
|
||||
NoncharacterCharacterReference,
|
||||
MissingWhitespaceBeforeDoctypeName,
|
||||
MissingDoctypeName,
|
||||
InvalidCharacterSequenceAfterDoctypeName,
|
||||
DuplicateAttribute,
|
||||
NonConformingDoctype,
|
||||
MissingDoctype,
|
||||
MisplacedDoctype,
|
||||
EndTagWithoutMatchingOpenElement,
|
||||
ClosingOfElementWithOpenChildElements,
|
||||
DisallowedContentInNoscriptInHead,
|
||||
OpenElementsLeftAfterEof,
|
||||
AbandonedHeadElementChild,
|
||||
MisplacedStartTagForHeadElement,
|
||||
NestedNoscriptInHead,
|
||||
EofInElementThatCanContainOnlyText,
|
||||
SurrogateInInputStream,
|
||||
UnexpectedCharacterAfterDoctypeSystemIdentifier,
|
||||
UnexpectedCharacterInAttributeName,
|
||||
UnexpectedCharacterInUnquotedAttributeValue,
|
||||
UnexpectedEqualsSignBeforeAttributeName,
|
||||
UnexpectedNullCharacter,
|
||||
UnexpectedQuestionMarkInsteadOfTagName,
|
||||
UnexpectedSolidusInTag,
|
||||
UnknownNamedCharacterReference,
|
||||
|
||||
// Parser errors
|
||||
UnexpectedToken,
|
||||
StrayDoctype,
|
||||
StrayStartTag(JsWord),
|
||||
StrayEndTag(JsWord),
|
||||
NestedHeadingTags,
|
||||
NoTableRowToClose,
|
||||
UnclosedElements(JsWord),
|
||||
UnclosedElementsImplied(JsWord),
|
||||
UnclosedElementsCell,
|
||||
StrayDoctype,
|
||||
NonConformingDoctype,
|
||||
NonSpaceCharacterInTrailer,
|
||||
NonSpaceCharacterAfterFrameset,
|
||||
NonSpaceCharacterInFrameset,
|
||||
NonSpaceCharacterAfterBody,
|
||||
NonSpaceCharacterInColumnGroup,
|
||||
NonSpaceCharacterInNoscriptInHead,
|
||||
SomethingBetweenHeadAndBody(JsWord),
|
||||
StartTagWithoutDoctype,
|
||||
StartSelectWhereEndSelectExpected,
|
||||
StartTagWithSelectOpen(JsWord),
|
||||
BadStartTagInNoscriptInHead(JsWord),
|
||||
UnexpectedImageStartTag,
|
||||
SomethingSeenWhenSomethingOpen(JsWord),
|
||||
HeadingWhenHeadingOpen,
|
||||
NoCellToClose,
|
||||
StartTagInTable(JsWord),
|
||||
FormWhenFormOpen,
|
||||
TableSeenWhileTableOpen,
|
||||
StartTagSeenWhenAlreadyOpen(JsWord),
|
||||
NoElementToCloseButEndTagSeen(JsWord),
|
||||
UnexpectedImageStartTag,
|
||||
UnexpectedStartSelectWhereEndSelectExpected,
|
||||
UnexpectedHtmlStartTagInForeignContext(JsWord),
|
||||
UnexpectedHtmlEndTagInForeignContext(JsWord),
|
||||
UnexpectedStartTagBetweenHeadAndBody(JsWord),
|
||||
UnexpectedEndTag(JsWord),
|
||||
UnexpectedStartTagInTable(JsWord),
|
||||
UnexpectedStartTagWithSelectOpen(JsWord),
|
||||
UnexpectedEndTagWithSelectOpen(JsWord),
|
||||
UnexpectedStartTagInRuby(JsWord),
|
||||
UnexpectedEndTagWithUnclosedElements(JsWord),
|
||||
UnexpectedEof,
|
||||
UnclosedElementsImplied(JsWord),
|
||||
UnclosedElements(JsWord),
|
||||
UnclosedElementsOnStack,
|
||||
UnclosedElementsCell,
|
||||
NonSpaceCharacterInFrameset,
|
||||
EndTagDidNotMatchCurrentOpenElement(JsWord, JsWord),
|
||||
NonSpaceCharacterAfterFrameset,
|
||||
NonSpaceCharacterInTrailer,
|
||||
NonSpaceAfterBody,
|
||||
StartTagInTableBody(JsWord),
|
||||
EndTagSeenWithoutDoctype,
|
||||
EndTagAfterBody,
|
||||
NonSpaceInNoscriptInHead,
|
||||
BadStartTagInNoscriptInHead(JsWord),
|
||||
EndTagSeenWithSelectOpen(JsWord),
|
||||
GarbageInColumnGroup,
|
||||
EndTagBr,
|
||||
NoElementToCloseButEndTagSeen(JsWord),
|
||||
HtmlStartTagInForeignContext(JsWord),
|
||||
NoTableRowToClose,
|
||||
NonSpaceCharacterInTable,
|
||||
UnclosedChildrenInRuby,
|
||||
StartTagSeenWithoutRuby(JsWord),
|
||||
UnclosedElementsOnStack,
|
||||
EndTagDidNotMatchCurrentOpenElement(JsWord, JsWord),
|
||||
EndTagViolatesNestingRules(JsWord),
|
||||
EofWithUnclosedElements,
|
||||
EndTagWithUnclosedElements(JsWord),
|
||||
NonSpaceCharacterWithoutDoctype,
|
||||
EofWithoutDoctype,
|
||||
EofInText,
|
||||
}
|
||||
|
@ -452,8 +452,6 @@ where
|
||||
token,
|
||||
};
|
||||
|
||||
self.tree_construction_dispatcher(&mut token_and_info)?;
|
||||
|
||||
// Re-emit errors from tokenizer
|
||||
for error in self.input.take_errors() {
|
||||
let (span, kind) = *error.into_inner();
|
||||
@ -461,6 +459,8 @@ where
|
||||
self.errors.push(Error::new(span, kind));
|
||||
}
|
||||
|
||||
self.tree_construction_dispatcher(&mut token_and_info)?;
|
||||
|
||||
// When a start tag token is emitted with its self-closing flag set,
|
||||
// if the flag is not acknowledged when it is processed by the tree
|
||||
// construction stage, that is a parse error.
|
||||
@ -677,7 +677,7 @@ where
|
||||
{
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::UnexpectedHtmlStartTagInForeignContext(tag_name.clone()),
|
||||
ErrorKind::HtmlStartTagInForeignContext(tag_name.clone()),
|
||||
));
|
||||
self.open_elements_stack.pop_until_in_foreign();
|
||||
self.process_token(token_and_info, None)?;
|
||||
@ -693,15 +693,17 @@ where
|
||||
{
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::UnexpectedHtmlStartTagInForeignContext(tag_name.clone()),
|
||||
ErrorKind::HtmlStartTagInForeignContext(tag_name.clone()),
|
||||
));
|
||||
self.open_elements_stack.pop_until_in_foreign();
|
||||
self.process_token(token_and_info, None)?;
|
||||
}
|
||||
Token::EndTag { tag_name, .. } if matches!(tag_name.as_ref(), "br" | "p") => {
|
||||
let last = get_tag_name!(self.open_elements_stack.items.last().unwrap());
|
||||
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::UnexpectedHtmlEndTagInForeignContext(tag_name.clone()),
|
||||
ErrorKind::EndTagDidNotMatchCurrentOpenElement(tag_name.clone(), last.into()),
|
||||
));
|
||||
self.open_elements_stack.pop_until_in_foreign();
|
||||
self.process_token(token_and_info, None)?;
|
||||
@ -1276,8 +1278,35 @@ where
|
||||
// token.
|
||||
_ => {
|
||||
if !self.config.iframe_srcdoc {
|
||||
self.errors
|
||||
.push(Error::new(token_and_info.span, ErrorKind::MissingDoctype));
|
||||
match &token {
|
||||
Token::StartTag { .. } => {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::StartTagWithoutDoctype,
|
||||
));
|
||||
}
|
||||
Token::EndTag { .. } => {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::EndTagSeenWithoutDoctype,
|
||||
));
|
||||
}
|
||||
Token::Character { .. } => {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::NonSpaceCharacterWithoutDoctype,
|
||||
));
|
||||
}
|
||||
Token::Eof => {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::EofWithoutDoctype,
|
||||
));
|
||||
}
|
||||
_ => {
|
||||
unreachable!();
|
||||
}
|
||||
}
|
||||
|
||||
self.document_mode = DocumentMode::Quirks;
|
||||
}
|
||||
@ -1382,10 +1411,10 @@ where
|
||||
// Any other end tag
|
||||
//
|
||||
// Parse error. Ignore the token.
|
||||
Token::EndTag { .. } => {
|
||||
Token::EndTag { tag_name, .. } => {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::EndTagWithoutMatchingOpenElement,
|
||||
ErrorKind::StrayEndTag(tag_name.clone()),
|
||||
));
|
||||
}
|
||||
// Anything else
|
||||
@ -1482,10 +1511,10 @@ where
|
||||
// Any other end tag
|
||||
//
|
||||
// Parse error. Ignore the token.
|
||||
Token::EndTag { .. } => {
|
||||
Token::EndTag { tag_name, .. } => {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::EndTagWithoutMatchingOpenElement,
|
||||
ErrorKind::StrayEndTag(tag_name.clone()),
|
||||
));
|
||||
}
|
||||
// Anything else
|
||||
@ -1778,7 +1807,7 @@ where
|
||||
Token::StartTag { tag_name, .. } if tag_name == "head" => {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::StartTagSeenWhenAlreadyOpen(tag_name.clone()),
|
||||
ErrorKind::SomethingSeenWhenSomethingOpen(tag_name.clone()),
|
||||
));
|
||||
}
|
||||
Token::EndTag { tag_name, .. } => {
|
||||
@ -1808,7 +1837,7 @@ where
|
||||
Token::Character { .. } => {
|
||||
parser.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::NonSpaceInNoscriptInHead,
|
||||
ErrorKind::NonSpaceCharacterInNoscriptInHead,
|
||||
));
|
||||
}
|
||||
Token::StartTag { tag_name, .. } => {
|
||||
@ -1909,7 +1938,7 @@ where
|
||||
{
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::StartTagSeenWhenAlreadyOpen(tag_name.clone()),
|
||||
ErrorKind::SomethingSeenWhenSomethingOpen(tag_name.clone()),
|
||||
));
|
||||
}
|
||||
Token::EndTag { tag_name, .. } => {
|
||||
@ -2034,7 +2063,7 @@ where
|
||||
{
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::UnexpectedStartTagBetweenHeadAndBody(tag_name.clone()),
|
||||
ErrorKind::SomethingBetweenHeadAndBody(tag_name.clone()),
|
||||
));
|
||||
|
||||
let head = self
|
||||
@ -2217,7 +2246,7 @@ where
|
||||
} if tag_name == "body" => {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::StartTagSeenWhenAlreadyOpen(tag_name.clone()),
|
||||
ErrorKind::SomethingSeenWhenSomethingOpen(tag_name.clone()),
|
||||
));
|
||||
|
||||
let is_second_body = matches!(self.open_elements_stack.items.get(1), Some(node) if is_html_element!(node, "body"));
|
||||
@ -2344,7 +2373,7 @@ where
|
||||
) {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::UnexpectedEof,
|
||||
ErrorKind::EofWithUnclosedElements,
|
||||
));
|
||||
|
||||
break;
|
||||
@ -2399,7 +2428,7 @@ where
|
||||
) {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::UnexpectedEndTagWithUnclosedElements("body".into()),
|
||||
ErrorKind::EndTagWithUnclosedElements("body".into()),
|
||||
));
|
||||
|
||||
break;
|
||||
@ -2456,7 +2485,7 @@ where
|
||||
) {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::UnexpectedEndTagWithUnclosedElements("html".into()),
|
||||
ErrorKind::EndTagWithUnclosedElements("html".into()),
|
||||
));
|
||||
|
||||
break;
|
||||
@ -2505,7 +2534,7 @@ where
|
||||
) =>
|
||||
{
|
||||
if self.open_elements_stack.has_in_button_scope("p") {
|
||||
self.close_p_element();
|
||||
self.close_p_element(token_and_info);
|
||||
}
|
||||
|
||||
self.insert_html_element(token_and_info)?;
|
||||
@ -2524,7 +2553,7 @@ where
|
||||
if matches!(tag_name.as_ref(), "h1" | "h2" | "h3" | "h4" | "h5" | "h6") =>
|
||||
{
|
||||
if self.open_elements_stack.has_in_button_scope("p") {
|
||||
self.close_p_element();
|
||||
self.close_p_element(token_and_info);
|
||||
}
|
||||
|
||||
match self.open_elements_stack.items.last() {
|
||||
@ -2536,7 +2565,7 @@ where
|
||||
{
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::NestedHeadingTags,
|
||||
ErrorKind::HeadingWhenHeadingOpen,
|
||||
));
|
||||
|
||||
self.open_elements_stack.pop();
|
||||
@ -2562,7 +2591,7 @@ where
|
||||
if matches!(tag_name.as_ref(), "pre" | "listing") =>
|
||||
{
|
||||
if self.open_elements_stack.has_in_button_scope("p") {
|
||||
self.close_p_element();
|
||||
self.close_p_element(token_and_info);
|
||||
}
|
||||
|
||||
self.insert_html_element(token_and_info)?;
|
||||
@ -2600,7 +2629,7 @@ where
|
||||
}
|
||||
|
||||
if self.open_elements_stack.has_in_button_scope("p") {
|
||||
self.close_p_element();
|
||||
self.close_p_element(token_and_info);
|
||||
}
|
||||
|
||||
let element = self.insert_html_element(token_and_info)?;
|
||||
@ -2685,7 +2714,7 @@ where
|
||||
// If the stack of open elements has a p element in button scope,
|
||||
// then close a p element.
|
||||
if self.open_elements_stack.has_in_button_scope("p") {
|
||||
self.close_p_element();
|
||||
self.close_p_element(token_and_info);
|
||||
}
|
||||
|
||||
self.insert_html_element(token_and_info)?;
|
||||
@ -2802,7 +2831,7 @@ where
|
||||
// If the stack of open elements has a p element in button scope,
|
||||
// then close a p element.
|
||||
if self.open_elements_stack.has_in_button_scope("p") {
|
||||
self.close_p_element();
|
||||
self.close_p_element(token_and_info);
|
||||
}
|
||||
|
||||
self.insert_html_element(token_and_info)?;
|
||||
@ -2817,7 +2846,7 @@ where
|
||||
// Switch the tokenizer to the PLAINTEXT state.
|
||||
Token::StartTag { tag_name, .. } if tag_name == "plaintext" => {
|
||||
if self.open_elements_stack.has_in_button_scope("p") {
|
||||
self.close_p_element();
|
||||
self.close_p_element(token_and_info);
|
||||
}
|
||||
|
||||
self.insert_html_element(token_and_info)?;
|
||||
@ -2844,7 +2873,7 @@ where
|
||||
if self.open_elements_stack.has_in_scope("button") {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::StartTagSeenWhenAlreadyOpen(tag_name.clone()),
|
||||
ErrorKind::SomethingSeenWhenSomethingOpen(tag_name.clone()),
|
||||
));
|
||||
self.open_elements_stack.generate_implied_end_tags();
|
||||
self.open_elements_stack
|
||||
@ -3053,7 +3082,7 @@ where
|
||||
})?;
|
||||
}
|
||||
|
||||
self.close_p_element();
|
||||
self.close_p_element(token_and_info);
|
||||
}
|
||||
// An end tag whose tag name is "li"
|
||||
//
|
||||
@ -3223,7 +3252,7 @@ where
|
||||
if let Some(element) = node {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::StartTagSeenWhenAlreadyOpen(tag_name.clone()),
|
||||
ErrorKind::SomethingSeenWhenSomethingOpen(tag_name.clone()),
|
||||
));
|
||||
|
||||
let remove = element.clone();
|
||||
@ -3293,7 +3322,7 @@ where
|
||||
if self.open_elements_stack.has_in_scope("nobr") {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::StartTagSeenWhenAlreadyOpen(tag_name.clone()),
|
||||
ErrorKind::SomethingSeenWhenSomethingOpen(tag_name.clone()),
|
||||
));
|
||||
|
||||
self.run_the_adoption_agency_algorithm(token_and_info)?;
|
||||
@ -3406,7 +3435,7 @@ where
|
||||
if self.document_mode != DocumentMode::Quirks
|
||||
&& self.open_elements_stack.has_in_button_scope("p")
|
||||
{
|
||||
self.close_p_element();
|
||||
self.close_p_element(token_and_info);
|
||||
}
|
||||
|
||||
self.insert_html_element(token_and_info)?;
|
||||
@ -3426,10 +3455,8 @@ where
|
||||
} if tag_name == "br" => {
|
||||
let is_self_closing = *self_closing;
|
||||
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::UnexpectedEndTag(tag_name.clone()),
|
||||
));
|
||||
self.errors
|
||||
.push(Error::new(token_and_info.span, ErrorKind::EndTagBr));
|
||||
|
||||
self.reconstruct_active_formatting_elements()?;
|
||||
self.insert_html_element(&mut TokenAndInfo {
|
||||
@ -3565,7 +3592,7 @@ where
|
||||
..
|
||||
} if tag_name == "hr" => {
|
||||
if self.open_elements_stack.has_in_button_scope("p") {
|
||||
self.close_p_element();
|
||||
self.close_p_element(&mut token_and_info.clone());
|
||||
}
|
||||
|
||||
let is_self_closing = *self_closing;
|
||||
@ -3649,7 +3676,7 @@ where
|
||||
// Follow the generic raw text element parsing algorithm.
|
||||
Token::StartTag { tag_name, .. } if tag_name == "xmp" => {
|
||||
if self.open_elements_stack.has_in_button_scope("p") {
|
||||
self.close_p_element();
|
||||
self.close_p_element(token_and_info);
|
||||
}
|
||||
|
||||
self.reconstruct_active_formatting_elements()?;
|
||||
@ -3738,16 +3765,25 @@ where
|
||||
Token::StartTag { tag_name, .. }
|
||||
if matches!(tag_name.as_ref(), "rb" | "rtc") =>
|
||||
{
|
||||
if self.open_elements_stack.has_in_scope("ruby") {
|
||||
let is_scope = self.open_elements_stack.has_in_scope("ruby");
|
||||
|
||||
if is_scope {
|
||||
self.open_elements_stack.generate_implied_end_tags();
|
||||
}
|
||||
|
||||
match self.open_elements_stack.items.last() {
|
||||
Some(node) if !is_html_element!(node, "ruby") => {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::UnexpectedStartTagInRuby(tag_name.clone()),
|
||||
));
|
||||
if !is_scope {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::StartTagSeenWithoutRuby(tag_name.clone()),
|
||||
));
|
||||
} else {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::UnclosedChildrenInRuby,
|
||||
));
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
@ -3764,17 +3800,26 @@ where
|
||||
Token::StartTag { tag_name, .. }
|
||||
if matches!(tag_name.as_ref(), "rp" | "rt") =>
|
||||
{
|
||||
if self.open_elements_stack.has_in_scope("ruby") {
|
||||
let in_scope = self.open_elements_stack.has_in_scope("ruby");
|
||||
|
||||
if in_scope {
|
||||
self.open_elements_stack
|
||||
.generate_implied_end_tags_with_exclusion("rtc");
|
||||
}
|
||||
|
||||
match self.open_elements_stack.items.last() {
|
||||
Some(node) if !is_html_element!(node, "rtc" | "ruby") => {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::UnexpectedStartTagInRuby(tag_name.clone()),
|
||||
));
|
||||
if !in_scope {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::StartTagSeenWithoutRuby(tag_name.clone()),
|
||||
));
|
||||
} else {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::UnclosedChildrenInRuby,
|
||||
));
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
@ -4047,7 +4092,7 @@ where
|
||||
// token.
|
||||
Token::Eof => {
|
||||
self.errors
|
||||
.push(Error::new(token_and_info.span, ErrorKind::UnexpectedEof));
|
||||
.push(Error::new(token_and_info.span, ErrorKind::EofInText));
|
||||
self.open_elements_stack.pop();
|
||||
self.insertion_mode = self.original_insertion_mode.clone();
|
||||
self.process_token(token_and_info, None)?;
|
||||
@ -4414,7 +4459,7 @@ where
|
||||
} else {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::UnexpectedStartTagInTable(tag_name.clone()),
|
||||
ErrorKind::StartTagInTable(tag_name.clone()),
|
||||
));
|
||||
|
||||
self.insert_html_element(token_and_info)?;
|
||||
@ -4441,7 +4486,7 @@ where
|
||||
Token::StartTag { tag_name, .. } if tag_name == "form" => {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::UnexpectedStartTagInTable(tag_name.clone()),
|
||||
ErrorKind::StartTagInTable(tag_name.clone()),
|
||||
));
|
||||
|
||||
if self.open_elements_stack.contains_template_element()
|
||||
@ -4818,10 +4863,20 @@ where
|
||||
//
|
||||
// Reprocess the token.
|
||||
_ => match self.open_elements_stack.items.last() {
|
||||
Some(node) if !is_html_element!(node, "colgroup") => {
|
||||
self.errors
|
||||
.push(Error::new(token_and_info.span, ErrorKind::UnexpectedToken));
|
||||
}
|
||||
Some(node) if !is_html_element!(node, "colgroup") => match token {
|
||||
Token::Character { .. } => {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::NonSpaceCharacterInColumnGroup,
|
||||
));
|
||||
}
|
||||
_ => {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::GarbageInColumnGroup,
|
||||
));
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
self.open_elements_stack.pop();
|
||||
self.insertion_mode = InsertionMode::InTable;
|
||||
@ -4861,7 +4916,7 @@ where
|
||||
{
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::UnexpectedStartTagInTable(tag_name.clone()),
|
||||
ErrorKind::StartTagInTableBody(tag_name.clone()),
|
||||
));
|
||||
self.open_elements_stack.clear_back_to_table_body_context();
|
||||
self.insert_html_element(&mut TokenAndInfo {
|
||||
@ -5440,7 +5495,7 @@ where
|
||||
Token::StartTag { tag_name, .. } if tag_name == "select" => {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::UnexpectedStartSelectWhereEndSelectExpected,
|
||||
ErrorKind::StartSelectWhereEndSelectExpected,
|
||||
));
|
||||
|
||||
if !self.open_elements_stack.has_in_select_scope("select") {
|
||||
@ -5448,6 +5503,7 @@ where
|
||||
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
self.open_elements_stack
|
||||
.pop_until_tag_name_popped(&["select"]);
|
||||
self.reset_insertion_mode();
|
||||
@ -5472,7 +5528,7 @@ where
|
||||
{
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::UnexpectedStartTagWithSelectOpen(tag_name.clone()),
|
||||
ErrorKind::StartTagWithSelectOpen(tag_name.clone()),
|
||||
));
|
||||
|
||||
if !self.open_elements_stack.has_in_select_scope("select") {
|
||||
@ -5507,10 +5563,23 @@ where
|
||||
// Anything else
|
||||
//
|
||||
// Parse error. Ignore the token.
|
||||
_ => {
|
||||
self.errors
|
||||
.push(Error::new(token_and_info.span, ErrorKind::UnexpectedToken));
|
||||
}
|
||||
_ => match token {
|
||||
Token::StartTag { tag_name, .. } => {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::StrayStartTag(tag_name.clone()),
|
||||
));
|
||||
}
|
||||
Token::EndTag { tag_name, .. } => {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::StrayEndTag(tag_name.clone()),
|
||||
));
|
||||
}
|
||||
_ => {
|
||||
unreachable!()
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
// The "in select in table" insertion mode
|
||||
@ -5537,7 +5606,7 @@ where
|
||||
{
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::UnexpectedStartTagWithSelectOpen(tag_name.clone()),
|
||||
ErrorKind::StartTagWithSelectOpen(tag_name.clone()),
|
||||
));
|
||||
self.open_elements_stack
|
||||
.pop_until_tag_name_popped(&["select"]);
|
||||
@ -5569,7 +5638,7 @@ where
|
||||
{
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::UnexpectedEndTagWithSelectOpen(tag_name.clone()),
|
||||
ErrorKind::EndTagSeenWithSelectOpen(tag_name.clone()),
|
||||
));
|
||||
|
||||
if !self.open_elements_stack.has_in_table_scope(tag_name) {
|
||||
@ -5748,8 +5817,10 @@ where
|
||||
if !self.open_elements_stack.contains_template_element() {
|
||||
self.stopped = true;
|
||||
} else {
|
||||
self.errors
|
||||
.push(Error::new(token_and_info.span, ErrorKind::UnexpectedEof));
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::EofWithUnclosedElements,
|
||||
));
|
||||
self.open_elements_stack
|
||||
.pop_until_tag_name_popped(&["template"]);
|
||||
self.active_formatting_elements.clear_to_last_marker();
|
||||
@ -5828,7 +5899,7 @@ where
|
||||
Token::Character { .. } => {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::NonSpaceAfterBody,
|
||||
ErrorKind::NonSpaceCharacterAfterBody,
|
||||
));
|
||||
}
|
||||
Token::StartTag { tag_name, .. } => {
|
||||
@ -5971,7 +6042,7 @@ where
|
||||
Some(node) if !is_html_element!(node, "html") => {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::UnexpectedEof,
|
||||
ErrorKind::EofWithUnclosedElements,
|
||||
));
|
||||
}
|
||||
_ => {}
|
||||
@ -6252,8 +6323,29 @@ where
|
||||
&mut self,
|
||||
token_and_info: &mut TokenAndInfo,
|
||||
) -> PResult<()> {
|
||||
self.errors
|
||||
.push(Error::new(token_and_info.span, ErrorKind::UnexpectedToken));
|
||||
match &token_and_info.token {
|
||||
Token::StartTag { tag_name, .. } => {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::StartTagInTable(tag_name.clone()),
|
||||
));
|
||||
}
|
||||
Token::EndTag { tag_name, .. } => {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::StrayEndTag(tag_name.clone()),
|
||||
));
|
||||
}
|
||||
Token::Character { .. } => {
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::NonSpaceCharacterInTable,
|
||||
));
|
||||
}
|
||||
_ => {
|
||||
unreachable!();
|
||||
}
|
||||
}
|
||||
|
||||
let saved_foster_parenting_state = self.foster_parenting_enabled;
|
||||
|
||||
@ -6306,8 +6398,10 @@ where
|
||||
|
||||
// 3.
|
||||
if self.is_special_element(node) {
|
||||
self.errors
|
||||
.push(Error::new(token_and_info.span, ErrorKind::UnexpectedToken));
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::StrayEndTag(tag_name.clone()),
|
||||
));
|
||||
|
||||
return;
|
||||
}
|
||||
@ -6315,8 +6409,10 @@ where
|
||||
|
||||
let match_idx = match match_idx {
|
||||
None => {
|
||||
self.errors
|
||||
.push(Error::new(token_and_info.span, ErrorKind::UnexpectedToken));
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::StrayEndTag(tag_name.clone()),
|
||||
));
|
||||
|
||||
return;
|
||||
}
|
||||
@ -6329,8 +6425,10 @@ where
|
||||
|
||||
// 2. - 2.
|
||||
if match_idx != self.open_elements_stack.items.len() - 1 {
|
||||
self.errors
|
||||
.push(Error::new(token_and_info.span, ErrorKind::UnexpectedToken));
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::UnclosedElements(tag_name.clone()),
|
||||
));
|
||||
}
|
||||
|
||||
// 2.- 3.
|
||||
@ -6821,8 +6919,10 @@ where
|
||||
.rposition(|n| is_same_node(n, &formatting_element.1));
|
||||
|
||||
if formatting_element_stack_index.is_none() {
|
||||
self.errors
|
||||
.push(Error::new(token_and_info.span, ErrorKind::UnexpectedToken));
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::NoElementToCloseButEndTagSeen(subject),
|
||||
));
|
||||
self.active_formatting_elements
|
||||
.remove(&formatting_element.1);
|
||||
|
||||
@ -6835,8 +6935,10 @@ where
|
||||
.open_elements_stack
|
||||
.has_node_in_scope(&formatting_element.1)
|
||||
{
|
||||
self.errors
|
||||
.push(Error::new(token_and_info.span, ErrorKind::UnexpectedToken));
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::NoElementToCloseButEndTagSeen(subject),
|
||||
));
|
||||
|
||||
return Ok(());
|
||||
}
|
||||
@ -6845,9 +6947,12 @@ where
|
||||
|
||||
// 6.
|
||||
if let Some(node) = self.open_elements_stack.items.last() {
|
||||
// errEndTagViolatesNestingRules(name);
|
||||
if !is_same_node(node, &formatting_element.1) {
|
||||
self.errors
|
||||
.push(Error::new(token_and_info.span, ErrorKind::UnexpectedToken));
|
||||
self.errors.push(Error::new(
|
||||
token_and_info.span,
|
||||
ErrorKind::EndTagViolatesNestingRules(subject.clone()),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@ -7198,7 +7303,7 @@ where
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn close_p_element(&mut self) {
|
||||
fn close_p_element(&mut self, token_and_info: &mut TokenAndInfo) {
|
||||
// When the steps above say the user agent is to close a p element, it means
|
||||
// that the user agent must run the following steps:
|
||||
|
||||
@ -7209,11 +7314,18 @@ where
|
||||
// 2. If the current node is not a p element, then this is a parse error.
|
||||
match self.open_elements_stack.items.last() {
|
||||
Some(node) if !is_html_element!(node, "p") => {
|
||||
let tag_name = get_tag_name!(node);
|
||||
let tag_name = match &token_and_info.token {
|
||||
Token::StartTag { tag_name, .. } | Token::EndTag { tag_name, .. } => {
|
||||
tag_name.clone()
|
||||
}
|
||||
_ => {
|
||||
unreachable!();
|
||||
}
|
||||
};
|
||||
|
||||
self.errors.push(Error::new(
|
||||
get_span!(node),
|
||||
ErrorKind::UnclosedElementsImplied(tag_name.into()),
|
||||
token_and_info.span,
|
||||
ErrorKind::UnclosedElementsImplied(tag_name),
|
||||
));
|
||||
}
|
||||
_ => {}
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,8 +1,8 @@
|
||||
|
||||
x Missing doctype
|
||||
|
||||
x Eof in tag
|
||||
,-[$DIR/tests/recovery/attribute/bogus/input.html:1:1]
|
||||
1 | <div test="test'></div>
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x End of file seen without seeing a doctype first, expected "<!DOCTYPE html>"
|
||||
|
@ -5,4 +5,4 @@
|
||||
: ^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Missing doctype
|
||||
x End of file seen without seeing a doctype first, expected "<!DOCTYPE html>"
|
||||
|
@ -5,4 +5,4 @@
|
||||
: ^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Missing doctype
|
||||
x End of file seen without seeing a doctype first, expected "<!DOCTYPE html>"
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
x Missing doctype
|
||||
x Non-space characters found without seeing a doctype first, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/comment/bogus-3/input.html:1:1]
|
||||
1 | FOO<!-->BAZ
|
||||
: ^
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
x Missing doctype
|
||||
x Non-space characters found without seeing a doctype first, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/comment/bogus-4/input.html:1:1]
|
||||
1 | FOO<!-->BAZ
|
||||
: ^
|
||||
|
@ -5,4 +5,4 @@
|
||||
: ^^^^^
|
||||
`----
|
||||
|
||||
x Missing doctype
|
||||
x End of file seen without seeing a doctype first, expected "<!DOCTYPE html>"
|
||||
|
@ -5,7 +5,7 @@
|
||||
: ^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Missing doctype
|
||||
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/comment/cdata-1/input.html:9:1]
|
||||
9 | <div>test</div>
|
||||
: ^^^^^
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
x Missing doctype
|
||||
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/comment/cdata-2/input.html:1:1]
|
||||
1 | <div><![CDATA[foo]]>
|
||||
: ^^^^^
|
||||
@ -11,4 +11,4 @@
|
||||
: ^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Unexpected end of file
|
||||
x End of file seen and there were open elements
|
||||
|
@ -1,11 +1,11 @@
|
||||
|
||||
x Missing doctype
|
||||
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/comment/inside-textarea/input.html:1:1]
|
||||
1 | <textarea><!--</textarea>--></textarea>
|
||||
: ^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Unexpected token
|
||||
x Stray end tag "textarea"
|
||||
,-[$DIR/tests/recovery/comment/inside-textarea/input.html:1:1]
|
||||
1 | <textarea><!--</textarea>--></textarea>
|
||||
: ^^^^^^^^^^^
|
||||
|
@ -1,12 +1,12 @@
|
||||
|
||||
x Non conforming doctype
|
||||
,-[$DIR/tests/recovery/doctype/eof/input.html:1:1]
|
||||
1 | <!DOCTYPE
|
||||
: ^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Eof in doctype
|
||||
,-[$DIR/tests/recovery/doctype/eof/input.html:1:1]
|
||||
1 | <!DOCTYPE
|
||||
: ^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Non conforming doctype
|
||||
,-[$DIR/tests/recovery/doctype/eof/input.html:1:1]
|
||||
1 | <!DOCTYPE
|
||||
: ^^^^^^^^^
|
||||
`----
|
||||
|
@ -1,12 +1,12 @@
|
||||
|
||||
x Non conforming doctype
|
||||
,-[$DIR/tests/recovery/doctype/no-doctype-name-line/input.html:1:1]
|
||||
1 | ,-> <!DOCTYPE
|
||||
2 | `-> >
|
||||
`----
|
||||
|
||||
x Missing doctype name
|
||||
,-[$DIR/tests/recovery/doctype/no-doctype-name-line/input.html:1:1]
|
||||
1 | ,-> <!DOCTYPE
|
||||
2 | `-> >
|
||||
`----
|
||||
|
||||
x Non conforming doctype
|
||||
,-[$DIR/tests/recovery/doctype/no-doctype-name-line/input.html:1:1]
|
||||
1 | ,-> <!DOCTYPE
|
||||
2 | `-> >
|
||||
`----
|
||||
|
@ -1,12 +1,12 @@
|
||||
|
||||
x Non conforming doctype
|
||||
,-[$DIR/tests/recovery/doctype/no-doctype-name-space/input.html:1:1]
|
||||
1 | <!DOCTYPE >
|
||||
: ^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Missing doctype name
|
||||
,-[$DIR/tests/recovery/doctype/no-doctype-name-space/input.html:1:1]
|
||||
1 | <!DOCTYPE >
|
||||
: ^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Non conforming doctype
|
||||
,-[$DIR/tests/recovery/doctype/no-doctype-name-space/input.html:1:1]
|
||||
1 | <!DOCTYPE >
|
||||
: ^^^^^^^^^^^
|
||||
`----
|
||||
|
@ -1,12 +1,12 @@
|
||||
|
||||
x Non conforming doctype
|
||||
,-[$DIR/tests/recovery/document_type/bogus/input.html:1:1]
|
||||
1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" SYSTEM "http://www.w3.org/TR/html4/strict.dtd">
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Missing quote before doctype system identifier
|
||||
,-[$DIR/tests/recovery/document_type/bogus/input.html:1:1]
|
||||
1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" SYSTEM "http://www.w3.org/TR/html4/strict.dtd">
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Non conforming doctype
|
||||
,-[$DIR/tests/recovery/document_type/bogus/input.html:1:1]
|
||||
1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" SYSTEM "http://www.w3.org/TR/html4/strict.dtd">
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
@ -1,12 +1,12 @@
|
||||
|
||||
x Non conforming doctype
|
||||
,-[$DIR/tests/recovery/document_type/missing-name/input.html:1:1]
|
||||
1 | <!DOCTYPE>
|
||||
: ^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Missing doctype name
|
||||
,-[$DIR/tests/recovery/document_type/missing-name/input.html:1:1]
|
||||
1 | <!DOCTYPE>
|
||||
: ^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Non conforming doctype
|
||||
,-[$DIR/tests/recovery/document_type/missing-name/input.html:1:1]
|
||||
1 | <!DOCTYPE>
|
||||
: ^^^^^^^^^^
|
||||
`----
|
||||
|
@ -1,12 +1,12 @@
|
||||
|
||||
x Non conforming doctype
|
||||
,-[$DIR/tests/recovery/document_type/unknown/input.html:1:1]
|
||||
1 | <!DOCTYPE >Hello
|
||||
: ^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Missing doctype name
|
||||
,-[$DIR/tests/recovery/document_type/unknown/input.html:1:1]
|
||||
1 | <!DOCTYPE >Hello
|
||||
: ^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Non conforming doctype
|
||||
,-[$DIR/tests/recovery/document_type/unknown/input.html:1:1]
|
||||
1 | <!DOCTYPE >Hello
|
||||
: ^^^^^^^^^^^
|
||||
`----
|
||||
|
@ -1,11 +1,11 @@
|
||||
|
||||
x Missing doctype
|
||||
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/element/a-1/input.html:1:1]
|
||||
1 | <a>1<p>2</a>3</p>
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x Unexpected token
|
||||
x End tag "a" violates nesting rules
|
||||
,-[$DIR/tests/recovery/element/a-1/input.html:1:1]
|
||||
1 | <a>1<p>2</a>3</p>
|
||||
: ^^^^
|
||||
|
@ -1,11 +1,11 @@
|
||||
|
||||
x Missing doctype
|
||||
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/element/a-2/input.html:1:1]
|
||||
1 | <a>1<button>2</a>3</button>
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x Unexpected token
|
||||
x End tag "a" violates nesting rules
|
||||
,-[$DIR/tests/recovery/element/a-2/input.html:1:1]
|
||||
1 | <a>1<button>2</a>3</button>
|
||||
: ^^^^
|
||||
|
@ -1,11 +1,11 @@
|
||||
|
||||
x Missing doctype
|
||||
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/element/a-3/input.html:1:1]
|
||||
1 | <a>1<div>2<div>3</a>4</div>5</div>
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x Unexpected token
|
||||
x End tag "a" violates nesting rules
|
||||
,-[$DIR/tests/recovery/element/a-3/input.html:1:1]
|
||||
1 | <a>1<div>2<div>3</a>4</div>5</div>
|
||||
: ^^^^
|
||||
|
@ -1,50 +1,56 @@
|
||||
|
||||
x Missing doctype
|
||||
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/element/a-4/input.html:1:1]
|
||||
1 | <table><a>1<p>2</a>3</p>
|
||||
: ^^^^^^^
|
||||
`----
|
||||
|
||||
x Unexpected token
|
||||
x Start tag "a" seen in "table"
|
||||
,-[$DIR/tests/recovery/element/a-4/input.html:1:1]
|
||||
1 | <table><a>1<p>2</a>3</p>
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x Unexpected token
|
||||
x Misplaced non-space characters inside a table
|
||||
,-[$DIR/tests/recovery/element/a-4/input.html:1:1]
|
||||
1 | <table><a>1<p>2</a>3</p>
|
||||
: ^
|
||||
`----
|
||||
|
||||
x Unexpected token
|
||||
x Start tag "p" seen in "table"
|
||||
,-[$DIR/tests/recovery/element/a-4/input.html:1:1]
|
||||
1 | <table><a>1<p>2</a>3</p>
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x Unexpected token
|
||||
x Misplaced non-space characters inside a table
|
||||
,-[$DIR/tests/recovery/element/a-4/input.html:1:1]
|
||||
1 | <table><a>1<p>2</a>3</p>
|
||||
: ^
|
||||
`----
|
||||
|
||||
x Unexpected token
|
||||
x Stray end tag "a"
|
||||
,-[$DIR/tests/recovery/element/a-4/input.html:1:1]
|
||||
1 | <table><a>1<p>2</a>3</p>
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Unexpected token
|
||||
x End tag "a" violates nesting rules
|
||||
,-[$DIR/tests/recovery/element/a-4/input.html:1:1]
|
||||
1 | <table><a>1<p>2</a>3</p>
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Misplaced non-space characters inside a table
|
||||
,-[$DIR/tests/recovery/element/a-4/input.html:1:1]
|
||||
1 | <table><a>1<p>2</a>3</p>
|
||||
: ^
|
||||
`----
|
||||
|
||||
x Unexpected token
|
||||
x Stray end tag "p"
|
||||
,-[$DIR/tests/recovery/element/a-4/input.html:1:1]
|
||||
1 | <table><a>1<p>2</a>3</p>
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Unexpected end of file
|
||||
x End of file seen and there were open elements
|
||||
|
@ -1,11 +1,11 @@
|
||||
|
||||
x Missing doctype
|
||||
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/element/a/input.html:1:1]
|
||||
1 | <a><p></a></p>
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x Unexpected token
|
||||
x End tag "a" violates nesting rules
|
||||
,-[$DIR/tests/recovery/element/a/input.html:1:1]
|
||||
1 | <a><p></a></p>
|
||||
: ^^^^
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
x Missing doctype
|
||||
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/element/applet-2/input.html:1:1]
|
||||
1 | <a><applet><a>x
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x Unexpected end of file
|
||||
x End of file seen and there were open elements
|
||||
|
@ -1,14 +1,14 @@
|
||||
|
||||
x Missing doctype
|
||||
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/element/applet/input.html:1:1]
|
||||
1 | <b><applet></b>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 | <b><applet></b>x
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Unexpected end of file
|
||||
x End of file seen and there were open elements
|
||||
|
@ -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 | <p>1<b>2<i>3</b>4</i>5</p>
|
||||
: ^^^^
|
||||
|
@ -1,11 +1,11 @@
|
||||
|
||||
x Missing doctype
|
||||
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/element/b-2/input.html:1:1]
|
||||
1 | <b><p>Bold </b> Not bold</p>
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x Unexpected token
|
||||
x End tag "b" violates nesting rules
|
||||
,-[$DIR/tests/recovery/element/b-2/input.html:1:1]
|
||||
1 | <b><p>Bold </b> Not bold</p>
|
||||
: ^^^^
|
||||
|
@ -1,14 +1,14 @@
|
||||
|
||||
x Missing doctype
|
||||
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/element/b-3/input.html:1:1]
|
||||
1 | <b><a><b><p></a>
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x Unexpected token
|
||||
x End tag "a" violates nesting rules
|
||||
,-[$DIR/tests/recovery/element/b-3/input.html:1:1]
|
||||
1 | <b><a><b><p></a>
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Unexpected end of file
|
||||
x End of file seen and there were open elements
|
||||
|
@ -1,11 +1,11 @@
|
||||
|
||||
x Missing doctype
|
||||
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/element/b/input.html:1:1]
|
||||
1 | <b>1<p>2</b>3</p>
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x Unexpected token
|
||||
x End tag "b" violates nesting rules
|
||||
,-[$DIR/tests/recovery/element/b/input.html:1:1]
|
||||
1 | <b>1<p>2</b>3</p>
|
||||
: ^^^^
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
x Unexpected end tag for "</body>", 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 | </body>
|
||||
: ^^^^^^^
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
x Stray start tag "<div>"
|
||||
x Stray start tag "div"
|
||||
,-[$DIR/tests/recovery/element/body-3/input.html:1:1]
|
||||
1 | <!DOCTYPE html>X</body><div>
|
||||
: ^^^^^
|
||||
`----
|
||||
|
||||
x Unexpected end of file
|
||||
x End of file seen and there were open elements
|
||||
|
@ -5,7 +5,7 @@
|
||||
: ^^^^^^
|
||||
`----
|
||||
|
||||
x Stray end tag "</div>"
|
||||
x Stray end tag "div"
|
||||
,-[$DIR/tests/recovery/element/body-4/input.html:1:1]
|
||||
1 | <!DOCTYPE html>X</body></div>
|
||||
: ^^^^^^
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
x Stray start tag "<html>"
|
||||
x Stray start tag "html"
|
||||
,-[$DIR/tests/recovery/element/body/broken/input.html:6:1]
|
||||
6 | <html test="test">
|
||||
: ^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,18 +1,18 @@
|
||||
|
||||
x Unexpected end tag "</br>"
|
||||
x End tag "br"
|
||||
,-[$DIR/tests/recovery/element/br/self-closing/input.html:11:5]
|
||||
11 | test</br>test
|
||||
: ^^^^^
|
||||
`----
|
||||
|
||||
x Unexpected end tag "</br>"
|
||||
,-[$DIR/tests/recovery/element/br/self-closing/input.html:12:5]
|
||||
12 | test</br/>test
|
||||
: ^^^^^^
|
||||
`----
|
||||
|
||||
x End tag with trailing solidus
|
||||
,-[$DIR/tests/recovery/element/br/self-closing/input.html:12:5]
|
||||
12 | test</br/>test
|
||||
: ^^^^^^
|
||||
`----
|
||||
|
||||
x End tag "br"
|
||||
,-[$DIR/tests/recovery/element/br/self-closing/input.html:12:5]
|
||||
12 | test</br/>test
|
||||
: ^^^^^^
|
||||
`----
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
x Missing doctype
|
||||
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/element/broken-end-tags/input.html:1:1]
|
||||
1 | <div></div>
|
||||
: ^^^^^
|
||||
|
@ -0,0 +1,20 @@
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| "
|
||||
"
|
||||
| <template>
|
||||
| content
|
||||
| <col>
|
||||
| "
|
||||
"
|
||||
| <template>
|
||||
| content
|
||||
| <col>
|
||||
| "
|
||||
"
|
||||
| <template>
|
||||
| content
|
||||
| <col>
|
||||
| "
|
||||
"
|
@ -0,0 +1,5 @@
|
||||
<body>
|
||||
<template><col><colgroup></template>
|
||||
<template><col><colgroup></div></template>
|
||||
<template><col><colgroup>A</template>
|
||||
</body>
|
@ -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
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
|
||||
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:1:1]
|
||||
1 | <body>
|
||||
: ^^^^^^
|
||||
`----
|
||||
|
||||
x Garbage in "colgroup" element
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:2:1]
|
||||
2 | <template><col><colgroup></template>
|
||||
: ^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Garbage in "colgroup" element
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:3:1]
|
||||
3 | <template><col><colgroup></div></template>
|
||||
: ^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Garbage in "colgroup" element
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:3:1]
|
||||
3 | <template><col><colgroup></div></template>
|
||||
: ^^^^^^
|
||||
`----
|
||||
|
||||
x Garbage in "colgroup" element
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:4:1]
|
||||
4 | <template><col><colgroup>A</template>
|
||||
: ^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Non-space character in "colgroup" element
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:4:1]
|
||||
4 | <template><col><colgroup>A</template>
|
||||
: ^
|
||||
`----
|
@ -0,0 +1,181 @@
|
||||
|
||||
x Document
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:1:1]
|
||||
1 | ,-> <body>
|
||||
2 | | <template><col><colgroup></template>
|
||||
3 | | <template><col><colgroup></div></template>
|
||||
4 | | <template><col><colgroup>A</template>
|
||||
5 | `-> </body>
|
||||
`----
|
||||
|
||||
x Child
|
||||
|
||||
x Element
|
||||
|
||||
x Child
|
||||
|
||||
x Element
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:1:1]
|
||||
1 | ,-> <body>
|
||||
2 | | <template><col><colgroup></template>
|
||||
3 | | <template><col><colgroup></div></template>
|
||||
4 | `-> <template><col><colgroup>A</template>
|
||||
5 | </body>
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:1:1]
|
||||
1 | ,-> <body>
|
||||
2 | | <template><col><colgroup></template>
|
||||
3 | | <template><col><colgroup></div></template>
|
||||
4 | `-> <template><col><colgroup>A</template>
|
||||
5 | </body>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:1:1]
|
||||
1 | <body>
|
||||
: ^
|
||||
2 | <template><col><colgroup></template>
|
||||
`----
|
||||
|
||||
x Text
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:1:1]
|
||||
1 | <body>
|
||||
: ^
|
||||
2 | <template><col><colgroup></template>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:2:1]
|
||||
2 | <template><col><colgroup></template>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:2:1]
|
||||
2 | <template><col><colgroup></template>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x DocumentFragment
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:2:1]
|
||||
2 | <template><col><colgroup></template>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:2:1]
|
||||
2 | <template><col><colgroup></template>
|
||||
: ^^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:2:1]
|
||||
2 | <template><col><colgroup></template>
|
||||
: ^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:2:1]
|
||||
2 | <template><col><colgroup></template>
|
||||
: ^
|
||||
3 | <template><col><colgroup></div></template>
|
||||
`----
|
||||
|
||||
x Text
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:2:1]
|
||||
2 | <template><col><colgroup></template>
|
||||
: ^
|
||||
3 | <template><col><colgroup></div></template>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:3:1]
|
||||
3 | <template><col><colgroup></div></template>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:3:1]
|
||||
3 | <template><col><colgroup></div></template>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x DocumentFragment
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:3:1]
|
||||
3 | <template><col><colgroup></div></template>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:3:1]
|
||||
3 | <template><col><colgroup></div></template>
|
||||
: ^^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:3:1]
|
||||
3 | <template><col><colgroup></div></template>
|
||||
: ^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:3:1]
|
||||
3 | <template><col><colgroup></div></template>
|
||||
: ^
|
||||
4 | <template><col><colgroup>A</template>
|
||||
`----
|
||||
|
||||
x Text
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:3:1]
|
||||
3 | <template><col><colgroup></div></template>
|
||||
: ^
|
||||
4 | <template><col><colgroup>A</template>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:4:1]
|
||||
4 | <template><col><colgroup>A</template>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:4:1]
|
||||
4 | <template><col><colgroup>A</template>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x DocumentFragment
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:4:1]
|
||||
4 | <template><col><colgroup>A</template>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:4:1]
|
||||
4 | <template><col><colgroup>A</template>
|
||||
: ^^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:4:1]
|
||||
4 | <template><col><colgroup>A</template>
|
||||
: ^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:4:1]
|
||||
4 | <template><col><colgroup>A</template>
|
||||
: ^
|
||||
5 | </body>
|
||||
`----
|
||||
|
||||
x Text
|
||||
,-[$DIR/tests/recovery/element/colgroup-1/input.html:4:1]
|
||||
4 | <template><col><colgroup>A</template>
|
||||
: ^
|
||||
5 | </body>
|
||||
`----
|
@ -1,11 +1,5 @@
|
||||
|
||||
x Unexpected token
|
||||
,-[$DIR/tests/recovery/element/colgroup/input.html:10:9]
|
||||
10 | </div>
|
||||
: ^^^^^^
|
||||
`----
|
||||
|
||||
x Stray end tag "</div>"
|
||||
x Stray end tag "div"
|
||||
,-[$DIR/tests/recovery/element/colgroup/input.html:10:9]
|
||||
10 | </div>
|
||||
: ^^^^^^
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
x Unexpected token
|
||||
x Stray end tag "embed"
|
||||
,-[$DIR/tests/recovery/element/embed-closed/input.html:11:1]
|
||||
11 | </embed>
|
||||
: ^^^^^^^^
|
||||
|
@ -1,14 +1,14 @@
|
||||
|
||||
x Missing doctype
|
||||
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/element/font/input.html:1:1]
|
||||
1 | <p><font size=4><font color=red><font color=red><p>X
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x End tag "</font>" 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 | <p><font size=4><font color=red><font color=red><p>X
|
||||
: ^^^^^^^^^^^^^^^^
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x Unexpected end of file
|
||||
x End of file seen and there were open elements
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,11 +1,11 @@
|
||||
|
||||
x Saw a "<form>" start tag, but there was already an active "<form>" element, nested forms are not allowed.
|
||||
x Saw a "form" start tag, but there was already an active "form" element, nested forms are not allowed
|
||||
,-[$DIR/tests/recovery/element/form/input.html:8:5]
|
||||
8 | <form action="test"></form>
|
||||
: ^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Stray end tag "</form>"
|
||||
x Stray end tag "form"
|
||||
,-[$DIR/tests/recovery/element/form/input.html:9:1]
|
||||
9 | </form>
|
||||
: ^^^^^^^
|
||||
|
@ -1,11 +1,11 @@
|
||||
|
||||
x Missing doctype
|
||||
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/element/frame/input.html:1:1]
|
||||
1 | <frame>test
|
||||
: ^^^^^^^
|
||||
`----
|
||||
|
||||
x Stray start tag "<frame>"
|
||||
x Stray start tag "frame"
|
||||
,-[$DIR/tests/recovery/element/frame/input.html:1:1]
|
||||
1 | <frame>test
|
||||
: ^^^^^^^
|
||||
|
@ -5,19 +5,19 @@
|
||||
2 | `-> "http://www.w3.org/TR/html4/frameset.dtd">
|
||||
`----
|
||||
|
||||
x Non-space character after "<frameset>"
|
||||
x Non-space character after "frameset"
|
||||
,-[$DIR/tests/recovery/element/frameset-1/input.html:16:1]
|
||||
16 | a
|
||||
: ^
|
||||
`----
|
||||
|
||||
x Stray start tag "<div>"
|
||||
x Stray start tag "div"
|
||||
,-[$DIR/tests/recovery/element/frameset-1/input.html:17:1]
|
||||
17 | <div></div>
|
||||
: ^^^^^
|
||||
`----
|
||||
|
||||
x Stray end tag "</div>"
|
||||
x Stray end tag "div"
|
||||
,-[$DIR/tests/recovery/element/frameset-1/input.html:17:1]
|
||||
17 | <div></div>
|
||||
: ^^^^^^
|
||||
|
@ -17,13 +17,13 @@
|
||||
: ^
|
||||
`----
|
||||
|
||||
x Stray start tag "<div>"
|
||||
x Stray start tag "div"
|
||||
,-[$DIR/tests/recovery/element/frameset-2/input.html:1:1]
|
||||
1 | <!doctype html><html><frameset></frameset></html>abc<div></div>
|
||||
: ^^^^^
|
||||
`----
|
||||
|
||||
x Stray end tag "</div>"
|
||||
x Stray end tag "div"
|
||||
,-[$DIR/tests/recovery/element/frameset-2/input.html:1:1]
|
||||
1 | <!doctype html><html><frameset></frameset></html>abc<div></div>
|
||||
: ^^^^^^
|
||||
|
@ -1,11 +1,11 @@
|
||||
|
||||
x Stray start tag "<frameset>"
|
||||
x Stray start tag "frameset"
|
||||
,-[$DIR/tests/recovery/element/frameset/input.html:7:1]
|
||||
7 | <frameset></frameset>
|
||||
: ^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Unexpected token
|
||||
x Stray end tag "frameset"
|
||||
,-[$DIR/tests/recovery/element/frameset/input.html:7:1]
|
||||
7 | <frameset></frameset>
|
||||
: ^^^^^^^^^^^
|
||||
|
@ -5,7 +5,7 @@
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Stray end tag "</h1>"
|
||||
x Stray end tag "h1"
|
||||
,-[$DIR/tests/recovery/element/h1/input.html:7:5]
|
||||
7 | <h1>test<h1>test</h1></h1>
|
||||
: ^^^^^
|
||||
@ -17,7 +17,7 @@
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Stray end tag "</h2>"
|
||||
x Stray end tag "h2"
|
||||
,-[$DIR/tests/recovery/element/h1/input.html:8:5]
|
||||
8 | <h2>test<h1>test</h1></h2>
|
||||
: ^^^^^
|
||||
@ -29,7 +29,7 @@
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Stray end tag "</h3>"
|
||||
x Stray end tag "h3"
|
||||
,-[$DIR/tests/recovery/element/h1/input.html:9:5]
|
||||
9 | <h3>test<h1>test</h1></h3>
|
||||
: ^^^^^
|
||||
@ -41,7 +41,7 @@
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Stray end tag "</h4>"
|
||||
x Stray end tag "h4"
|
||||
,-[$DIR/tests/recovery/element/h1/input.html:10:5]
|
||||
10 | <h4>test<h1>test</h1></h4>
|
||||
: ^^^^^
|
||||
@ -53,7 +53,7 @@
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Stray end tag "</h5>"
|
||||
x Stray end tag "h5"
|
||||
,-[$DIR/tests/recovery/element/h1/input.html:11:5]
|
||||
11 | <h5>test<h1>test</h1></h5>
|
||||
: ^^^^^
|
||||
@ -65,7 +65,7 @@
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Stray end tag "</h6>"
|
||||
x Stray end tag "h6"
|
||||
,-[$DIR/tests/recovery/element/h1/input.html:12:5]
|
||||
12 | <h6>test<h1>test</h1></h6>
|
||||
: ^^^^^
|
||||
@ -77,7 +77,7 @@
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Stray end tag "</h1>"
|
||||
x Stray end tag "h1"
|
||||
,-[$DIR/tests/recovery/element/h1/input.html:13:5]
|
||||
13 | <h1>test<h2>test</h2></h1>
|
||||
: ^^^^^
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
x Stray start tag "<head>"
|
||||
x Stray start tag "head"
|
||||
,-[$DIR/tests/recovery/element/head-1/input.html:6:1]
|
||||
6 | <head>
|
||||
: ^^^^^^
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
x Stray end tag "</head>"
|
||||
x Stray end tag "head"
|
||||
,-[$DIR/tests/recovery/element/head-2/input.html:6:1]
|
||||
6 | </head>
|
||||
: ^^^^^^^
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
x Unexpected HTML start tag "<meta>" between "</head>" and "<body>"
|
||||
x "meta" element between "head" and "body"
|
||||
,-[$DIR/tests/recovery/element/head/input.html:6:1]
|
||||
6 | <meta charset="UTF-8">
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,2 +1,2 @@
|
||||
|
||||
x Unexpected end of file
|
||||
x End of file seen and there were open elements
|
||||
|
@ -5,7 +5,7 @@
|
||||
: ^
|
||||
`----
|
||||
|
||||
x Stray end tag "</div>"
|
||||
x Stray end tag "div"
|
||||
,-[$DIR/tests/recovery/element/html-1/input.html:1:1]
|
||||
1 | <!DOCTYPE html>X</html>X</div>
|
||||
: ^^^^^^
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
x Unexpected end tag for "</html>", but there were unclosed elements
|
||||
x Unexpected end tag for "html", but there were unclosed elements
|
||||
,-[$DIR/tests/recovery/element/html/input.html:9:1]
|
||||
9 | </html>
|
||||
: ^^^^^^^
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
x Unexpected "<image>" start tag, only "<img>" tag exists in HTML
|
||||
x Saw a start tag "image", "img" element is outdated
|
||||
,-[$DIR/tests/recovery/element/image-1/input.html:1:1]
|
||||
1 | <!doctype html><image/>
|
||||
: ^^^^^^^^
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
x Unexpected "<image>" start tag, only "<img>" tag exists in HTML
|
||||
x Saw a start tag "image", "img" element is outdated
|
||||
,-[$DIR/tests/recovery/element/image/input.html:7:1]
|
||||
7 | <image src="test.png">
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
x Missing doctype
|
||||
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/element/isindex/input.html:1:1]
|
||||
1 | <isindex>
|
||||
: ^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Unexpected end of file
|
||||
x End of file seen and there were open elements
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
x Unexpected HTML start tag "<b>" in a foreign namespace context
|
||||
x HTML start tag "b" in a foreign namespace context
|
||||
,-[$DIR/tests/recovery/element/main-1/input.html:1:1]
|
||||
1 | <!DOCTYPE html>xxx<svg><x><g><a><main><b>
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x Unexpected end of file
|
||||
x End of file seen and there were open elements
|
||||
|
@ -1,2 +1,2 @@
|
||||
|
||||
x Unexpected end of file
|
||||
x End of file seen and there were open elements
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
x End tag "</marquee>" seen, but there were open elements
|
||||
x End tag "marquee" seen, but there were open elements
|
||||
,-[$DIR/tests/recovery/element/marquee/input.html:9:1]
|
||||
9 | </marquee>
|
||||
: ^^^^^^^^^^
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
x Unexpected token
|
||||
x Stray end tag "math"
|
||||
,-[$DIR/tests/recovery/element/math-1/input.html:9:1]
|
||||
9 | </math>
|
||||
: ^^^^^^^
|
||||
|
@ -5,7 +5,7 @@
|
||||
: ^^^^^^^
|
||||
`----
|
||||
|
||||
x Unexpected end tag for "</html>", but there were unclosed elements
|
||||
x Unexpected end tag for "html", but there were unclosed elements
|
||||
,-[$DIR/tests/recovery/element/math-2/input.html:1:1]
|
||||
1 | <!doctype html><math></html>
|
||||
: ^^^^^^^
|
||||
|
@ -1,11 +1,11 @@
|
||||
|
||||
x Stray start tag "<html>"
|
||||
x Stray start tag "html"
|
||||
,-[$DIR/tests/recovery/element/math/input.html:36:13]
|
||||
36 | <html xmlns="http://www.w3.org/1999/xhtml">
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Stray start tag "<head>"
|
||||
x Stray start tag "head"
|
||||
,-[$DIR/tests/recovery/element/math/input.html:37:13]
|
||||
37 | <head><title>INNER HTML TITLE</title></head>
|
||||
: ^^^^^^
|
||||
@ -17,13 +17,13 @@
|
||||
: ^^^^^^^
|
||||
`----
|
||||
|
||||
x Unexpected token
|
||||
x Stray end tag "head"
|
||||
,-[$DIR/tests/recovery/element/math/input.html:37:13]
|
||||
37 | <head><title>INNER HTML TITLE</title></head>
|
||||
: ^^^^^^^
|
||||
`----
|
||||
|
||||
x Start tag "<body>" seen but an element of the same type was already open
|
||||
x Start tag "body" seen but an element of the same type was already open
|
||||
,-[$DIR/tests/recovery/element/math/input.html:38:13]
|
||||
38 | <body>
|
||||
: ^^^^^^
|
||||
@ -35,7 +35,7 @@
|
||||
: ^^^^^^^
|
||||
`----
|
||||
|
||||
x Stray end tag "</body>"
|
||||
x Stray end tag "body"
|
||||
,-[$DIR/tests/recovery/element/math/input.html:40:13]
|
||||
40 | </body>
|
||||
: ^^^^^^^
|
||||
@ -47,7 +47,7 @@
|
||||
: ^^^^^^^
|
||||
`----
|
||||
|
||||
x Stray end tag "</html>"
|
||||
x Stray end tag "html"
|
||||
,-[$DIR/tests/recovery/element/math/input.html:41:13]
|
||||
41 | </html>
|
||||
: ^^^^^^^
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
x End tag "</li>" implied, but there were open elements
|
||||
x End tag "li" implied, but there were open elements
|
||||
,-[$DIR/tests/recovery/element/menuitem/input.html:1:1]
|
||||
1 | <!DOCTYPE html><li><menuitem><li>
|
||||
: ^^^^
|
||||
|
@ -1,14 +1,14 @@
|
||||
|
||||
x Start tag "<nobr>" seen but an element of the same type was already open
|
||||
x Start tag "nobr" seen but an element of the same type was already open
|
||||
,-[$DIR/tests/recovery/element/nobr-1/input.html:1:1]
|
||||
1 | <!doctype html><nobr><nobr><nobr>
|
||||
: ^^^^^^
|
||||
`----
|
||||
|
||||
x Start tag "<nobr>" seen but an element of the same type was already open
|
||||
x Start tag "nobr" seen but an element of the same type was already open
|
||||
,-[$DIR/tests/recovery/element/nobr-1/input.html:1:1]
|
||||
1 | <!doctype html><nobr><nobr><nobr>
|
||||
: ^^^^^^
|
||||
`----
|
||||
|
||||
x Unexpected end of file
|
||||
x End of file seen and there were open elements
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
x Missing doctype
|
||||
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/element/nobr/input.html:1:1]
|
||||
1 | <nobr>X
|
||||
: ^^^^^^
|
||||
`----
|
||||
|
||||
x Unexpected end of file
|
||||
x End of file seen and there were open elements
|
||||
|
@ -1,23 +1,23 @@
|
||||
|
||||
x Missing doctype
|
||||
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/element/noscript-1/input.html:1:1]
|
||||
1 | <head><noscript></br><!--foo--></noscript>
|
||||
: ^^^^^^
|
||||
`----
|
||||
|
||||
x Stray end tag "</br>"
|
||||
x Stray end tag "br"
|
||||
,-[$DIR/tests/recovery/element/noscript-1/input.html:1:1]
|
||||
1 | <head><noscript></br><!--foo--></noscript>
|
||||
: ^^^^^
|
||||
`----
|
||||
|
||||
x Unexpected end tag "</br>"
|
||||
x End tag "br"
|
||||
,-[$DIR/tests/recovery/element/noscript-1/input.html:1:1]
|
||||
1 | <head><noscript></br><!--foo--></noscript>
|
||||
: ^^^^^
|
||||
`----
|
||||
|
||||
x Unexpected token
|
||||
x Stray end tag "noscript"
|
||||
,-[$DIR/tests/recovery/element/noscript-1/input.html:1:1]
|
||||
1 | <head><noscript></br><!--foo--></noscript>
|
||||
: ^^^^^^^^^^^
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
x Missing doctype
|
||||
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/element/noscript-2/input.html:1:1]
|
||||
1 | <head><noscript>ABC<!--foo--></noscript>
|
||||
: ^^^^^^
|
||||
@ -11,7 +11,7 @@
|
||||
: ^
|
||||
`----
|
||||
|
||||
x Unexpected token
|
||||
x Stray end tag "noscript"
|
||||
,-[$DIR/tests/recovery/element/noscript-2/input.html:1:1]
|
||||
1 | <head><noscript>ABC<!--foo--></noscript>
|
||||
: ^^^^^^^^^^^
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
x Missing doctype
|
||||
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/element/noscript/input.html:1:1]
|
||||
1 | <head><noscript><!doctype html><!--foo--></noscript>
|
||||
: ^^^^^^
|
||||
|
@ -1,14 +1,14 @@
|
||||
|
||||
x Missing doctype
|
||||
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/element/p-1/input.html:1:1]
|
||||
1 | <div><p>a</x> b
|
||||
: ^^^^^
|
||||
`----
|
||||
|
||||
x Unexpected token
|
||||
x Stray end tag "x"
|
||||
,-[$DIR/tests/recovery/element/p-1/input.html:1:1]
|
||||
1 | <div><p>a</x> b
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Unexpected end of file
|
||||
x End of file seen and there were open elements
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
x Missing doctype
|
||||
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/element/p-2/input.html:1:1]
|
||||
1 | <p><table>
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x Unexpected end of file
|
||||
x End of file seen and there were open elements
|
||||
|
@ -0,0 +1,9 @@
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <p>
|
||||
| id="a"
|
||||
| <b>
|
||||
| <p>
|
||||
| id="b"
|
||||
| "TEST"
|
@ -0,0 +1 @@
|
||||
<p id=a><b><p id=b></b>TEST
|
128
crates/swc_html_parser/tests/recovery/element/p-3/output.json
Normal file
128
crates/swc_html_parser/tests/recovery/element/p-3/output.json
Normal file
@ -0,0 +1,128 @@
|
||||
{
|
||||
"type": "Document",
|
||||
"span": {
|
||||
"start": 1,
|
||||
"end": 28,
|
||||
"ctxt": 0
|
||||
},
|
||||
"mode": "quirks",
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 28,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "html",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 9,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "head",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [],
|
||||
"content": null
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 28,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "body",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 1,
|
||||
"end": 12,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "p",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"span": {
|
||||
"start": 4,
|
||||
"end": 8,
|
||||
"ctxt": 0
|
||||
},
|
||||
"namespace": null,
|
||||
"prefix": null,
|
||||
"name": "id",
|
||||
"value": "a"
|
||||
}
|
||||
],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 9,
|
||||
"end": 12,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "b",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 12,
|
||||
"end": 28,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "p",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"span": {
|
||||
"start": 15,
|
||||
"end": 19,
|
||||
"ctxt": 0
|
||||
},
|
||||
"namespace": null,
|
||||
"prefix": null,
|
||||
"name": "id",
|
||||
"value": "b"
|
||||
}
|
||||
],
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"span": {
|
||||
"start": 24,
|
||||
"end": 28,
|
||||
"ctxt": 0
|
||||
},
|
||||
"value": "TEST"
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
|
||||
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/element/p-3/input.html:1:1]
|
||||
1 | <p id=a><b><p id=b></b>TEST
|
||||
: ^^^^^^^^
|
||||
`----
|
||||
|
||||
x End tag "p" implied, but there were open elements
|
||||
,-[$DIR/tests/recovery/element/p-3/input.html:1:1]
|
||||
1 | <p id=a><b><p id=b></b>TEST
|
||||
: ^^^^^^^^
|
||||
`----
|
||||
|
||||
x No "b" element in scope but a "b" end tag seen
|
||||
,-[$DIR/tests/recovery/element/p-3/input.html:1:1]
|
||||
1 | <p id=a><b><p id=b></b>TEST
|
||||
: ^^^^
|
||||
`----
|
@ -0,0 +1,74 @@
|
||||
|
||||
x Document
|
||||
,-[$DIR/tests/recovery/element/p-3/input.html:1:1]
|
||||
1 | <p id=a><b><p id=b></b>TEST
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
|
||||
x Element
|
||||
|
||||
x Child
|
||||
|
||||
x Element
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/p-3/input.html:1:1]
|
||||
1 | <p id=a><b><p id=b></b>TEST
|
||||
: ^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/recovery/element/p-3/input.html:1:1]
|
||||
1 | <p id=a><b><p id=b></b>TEST
|
||||
: ^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Attribute
|
||||
,-[$DIR/tests/recovery/element/p-3/input.html:1:1]
|
||||
1 | <p id=a><b><p id=b></b>TEST
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/p-3/input.html:1:1]
|
||||
1 | <p id=a><b><p id=b></b>TEST
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/recovery/element/p-3/input.html:1:1]
|
||||
1 | <p id=a><b><p id=b></b>TEST
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/p-3/input.html:1:1]
|
||||
1 | <p id=a><b><p id=b></b>TEST
|
||||
: ^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/recovery/element/p-3/input.html:1:1]
|
||||
1 | <p id=a><b><p id=b></b>TEST
|
||||
: ^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Attribute
|
||||
,-[$DIR/tests/recovery/element/p-3/input.html:1:1]
|
||||
1 | <p id=a><b><p id=b></b>TEST
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/p-3/input.html:1:1]
|
||||
1 | <p id=a><b><p id=b></b>TEST
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Text
|
||||
,-[$DIR/tests/recovery/element/p-3/input.html:1:1]
|
||||
1 | <p id=a><b><p id=b></b>TEST
|
||||
: ^^^^
|
||||
`----
|
@ -1,11 +1,11 @@
|
||||
|
||||
x Missing doctype
|
||||
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
|
||||
,-[$DIR/tests/recovery/element/p/input.html:1:1]
|
||||
1 | <p>a<p>b</p></p>
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x No "p" element in scope but a "</p>" end tag seen
|
||||
x No "p" element in scope but a "p" end tag seen
|
||||
,-[$DIR/tests/recovery/element/p/input.html:1:1]
|
||||
1 | <p>a<p>b</p></p>
|
||||
: ^^^^
|
||||
|
@ -5,4 +5,4 @@
|
||||
2 | `-> "http://www.w3.org/TR/html4/strict.dtd">
|
||||
`----
|
||||
|
||||
x Unexpected end of file
|
||||
x End of file seen and there were open elements
|
||||
|
@ -0,0 +1,7 @@
|
||||
| <!DOCTYPE html>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <div>
|
||||
| <p>
|
||||
| <rt>
|
@ -0,0 +1 @@
|
||||
<!doctype html><div><p><rt>
|
104
crates/swc_html_parser/tests/recovery/element/rb-1/output.json
Normal file
104
crates/swc_html_parser/tests/recovery/element/rb-1/output.json
Normal file
@ -0,0 +1,104 @@
|
||||
{
|
||||
"type": "Document",
|
||||
"span": {
|
||||
"start": 1,
|
||||
"end": 28,
|
||||
"ctxt": 0
|
||||
},
|
||||
"mode": "no-quirks",
|
||||
"children": [
|
||||
{
|
||||
"type": "DocumentType",
|
||||
"span": {
|
||||
"start": 1,
|
||||
"end": 16,
|
||||
"ctxt": 0
|
||||
},
|
||||
"name": "html",
|
||||
"publicId": null,
|
||||
"systemId": null
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 28,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "html",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 21,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "head",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [],
|
||||
"content": null
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 28,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "body",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 16,
|
||||
"end": 28,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "div",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 21,
|
||||
"end": 28,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "p",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 24,
|
||||
"end": 28,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "rt",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
|
||||
x Start tag "rt" seen without a "ruby" element being open
|
||||
,-[$DIR/tests/recovery/element/rb-1/input.html:1:1]
|
||||
1 | <!doctype html><div><p><rt>
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x End of file seen and there were open elements
|
@ -0,0 +1,62 @@
|
||||
|
||||
x Document
|
||||
,-[$DIR/tests/recovery/element/rb-1/input.html:1:1]
|
||||
1 | <!doctype html><div><p><rt>
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/rb-1/input.html:1:1]
|
||||
1 | <!doctype html><div><p><rt>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x DocumentType
|
||||
,-[$DIR/tests/recovery/element/rb-1/input.html:1:1]
|
||||
1 | <!doctype html><div><p><rt>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
|
||||
x Element
|
||||
|
||||
x Child
|
||||
|
||||
x Element
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/rb-1/input.html:1:1]
|
||||
1 | <!doctype html><div><p><rt>
|
||||
: ^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/recovery/element/rb-1/input.html:1:1]
|
||||
1 | <!doctype html><div><p><rt>
|
||||
: ^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/rb-1/input.html:1:1]
|
||||
1 | <!doctype html><div><p><rt>
|
||||
: ^^^^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/recovery/element/rb-1/input.html:1:1]
|
||||
1 | <!doctype html><div><p><rt>
|
||||
: ^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/rb-1/input.html:1:1]
|
||||
1 | <!doctype html><div><p><rt>
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/recovery/element/rb-1/input.html:1:1]
|
||||
1 | <!doctype html><div><p><rt>
|
||||
: ^^^^
|
||||
`----
|
@ -0,0 +1,8 @@
|
||||
| <!DOCTYPE html>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <ruby>
|
||||
| <div>
|
||||
| <p>
|
||||
| <rb>
|
@ -0,0 +1 @@
|
||||
<!doctype html><ruby><div><p><rb>
|
117
crates/swc_html_parser/tests/recovery/element/rb/output.json
Normal file
117
crates/swc_html_parser/tests/recovery/element/rb/output.json
Normal file
@ -0,0 +1,117 @@
|
||||
{
|
||||
"type": "Document",
|
||||
"span": {
|
||||
"start": 1,
|
||||
"end": 34,
|
||||
"ctxt": 0
|
||||
},
|
||||
"mode": "no-quirks",
|
||||
"children": [
|
||||
{
|
||||
"type": "DocumentType",
|
||||
"span": {
|
||||
"start": 1,
|
||||
"end": 16,
|
||||
"ctxt": 0
|
||||
},
|
||||
"name": "html",
|
||||
"publicId": null,
|
||||
"systemId": null
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 34,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "html",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 22,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "head",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [],
|
||||
"content": null
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 34,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "body",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 16,
|
||||
"end": 34,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "ruby",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 22,
|
||||
"end": 34,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "div",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 27,
|
||||
"end": 30,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "p",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [],
|
||||
"content": null
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 30,
|
||||
"end": 34,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "rb",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
|
||||
x Unclosed children in "ruby"
|
||||
,-[$DIR/tests/recovery/element/rb/input.html:1:1]
|
||||
1 | <!doctype html><ruby><div><p><rb>
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x End of file seen and there were open elements
|
@ -0,0 +1,74 @@
|
||||
|
||||
x Document
|
||||
,-[$DIR/tests/recovery/element/rb/input.html:1:1]
|
||||
1 | <!doctype html><ruby><div><p><rb>
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/rb/input.html:1:1]
|
||||
1 | <!doctype html><ruby><div><p><rb>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x DocumentType
|
||||
,-[$DIR/tests/recovery/element/rb/input.html:1:1]
|
||||
1 | <!doctype html><ruby><div><p><rb>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
|
||||
x Element
|
||||
|
||||
x Child
|
||||
|
||||
x Element
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/rb/input.html:1:1]
|
||||
1 | <!doctype html><ruby><div><p><rb>
|
||||
: ^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/recovery/element/rb/input.html:1:1]
|
||||
1 | <!doctype html><ruby><div><p><rb>
|
||||
: ^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/rb/input.html:1:1]
|
||||
1 | <!doctype html><ruby><div><p><rb>
|
||||
: ^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/recovery/element/rb/input.html:1:1]
|
||||
1 | <!doctype html><ruby><div><p><rb>
|
||||
: ^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/rb/input.html:1:1]
|
||||
1 | <!doctype html><ruby><div><p><rb>
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/recovery/element/rb/input.html:1:1]
|
||||
1 | <!doctype html><ruby><div><p><rb>
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/rb/input.html:1:1]
|
||||
1 | <!doctype html><ruby><div><p><rb>
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/recovery/element/rb/input.html:1:1]
|
||||
1 | <!doctype html><ruby><div><p><rb>
|
||||
: ^^^^
|
||||
`----
|
@ -0,0 +1,7 @@
|
||||
| <!DOCTYPE html>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <div>
|
||||
| <p>
|
||||
| <rt>
|
@ -0,0 +1 @@
|
||||
<!doctype html><div><p><rt>
|
104
crates/swc_html_parser/tests/recovery/element/rt-1/output.json
Normal file
104
crates/swc_html_parser/tests/recovery/element/rt-1/output.json
Normal file
@ -0,0 +1,104 @@
|
||||
{
|
||||
"type": "Document",
|
||||
"span": {
|
||||
"start": 1,
|
||||
"end": 28,
|
||||
"ctxt": 0
|
||||
},
|
||||
"mode": "no-quirks",
|
||||
"children": [
|
||||
{
|
||||
"type": "DocumentType",
|
||||
"span": {
|
||||
"start": 1,
|
||||
"end": 16,
|
||||
"ctxt": 0
|
||||
},
|
||||
"name": "html",
|
||||
"publicId": null,
|
||||
"systemId": null
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 28,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "html",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 21,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "head",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [],
|
||||
"content": null
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 28,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "body",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 16,
|
||||
"end": 28,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "div",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 21,
|
||||
"end": 28,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "p",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 24,
|
||||
"end": 28,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "rt",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
|
||||
x Start tag "rt" seen without a "ruby" element being open
|
||||
,-[$DIR/tests/recovery/element/rt-1/input.html:1:1]
|
||||
1 | <!doctype html><div><p><rt>
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x End of file seen and there were open elements
|
@ -0,0 +1,62 @@
|
||||
|
||||
x Document
|
||||
,-[$DIR/tests/recovery/element/rt-1/input.html:1:1]
|
||||
1 | <!doctype html><div><p><rt>
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/rt-1/input.html:1:1]
|
||||
1 | <!doctype html><div><p><rt>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x DocumentType
|
||||
,-[$DIR/tests/recovery/element/rt-1/input.html:1:1]
|
||||
1 | <!doctype html><div><p><rt>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
|
||||
x Element
|
||||
|
||||
x Child
|
||||
|
||||
x Element
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/rt-1/input.html:1:1]
|
||||
1 | <!doctype html><div><p><rt>
|
||||
: ^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/recovery/element/rt-1/input.html:1:1]
|
||||
1 | <!doctype html><div><p><rt>
|
||||
: ^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/rt-1/input.html:1:1]
|
||||
1 | <!doctype html><div><p><rt>
|
||||
: ^^^^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/recovery/element/rt-1/input.html:1:1]
|
||||
1 | <!doctype html><div><p><rt>
|
||||
: ^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/rt-1/input.html:1:1]
|
||||
1 | <!doctype html><div><p><rt>
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/recovery/element/rt-1/input.html:1:1]
|
||||
1 | <!doctype html><div><p><rt>
|
||||
: ^^^^
|
||||
`----
|
@ -0,0 +1,8 @@
|
||||
| <!DOCTYPE html>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <ruby>
|
||||
| <div>
|
||||
| <p>
|
||||
| <rt>
|
@ -0,0 +1 @@
|
||||
<!doctype html><ruby><div><p><rt>
|
117
crates/swc_html_parser/tests/recovery/element/rt/output.json
Normal file
117
crates/swc_html_parser/tests/recovery/element/rt/output.json
Normal file
@ -0,0 +1,117 @@
|
||||
{
|
||||
"type": "Document",
|
||||
"span": {
|
||||
"start": 1,
|
||||
"end": 34,
|
||||
"ctxt": 0
|
||||
},
|
||||
"mode": "no-quirks",
|
||||
"children": [
|
||||
{
|
||||
"type": "DocumentType",
|
||||
"span": {
|
||||
"start": 1,
|
||||
"end": 16,
|
||||
"ctxt": 0
|
||||
},
|
||||
"name": "html",
|
||||
"publicId": null,
|
||||
"systemId": null
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 34,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "html",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 22,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "head",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [],
|
||||
"content": null
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 34,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "body",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 16,
|
||||
"end": 34,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "ruby",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 22,
|
||||
"end": 34,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "div",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 27,
|
||||
"end": 30,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "p",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [],
|
||||
"content": null
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 30,
|
||||
"end": 34,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "rt",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
|
||||
x Unclosed children in "ruby"
|
||||
,-[$DIR/tests/recovery/element/rt/input.html:1:1]
|
||||
1 | <!doctype html><ruby><div><p><rt>
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x End of file seen and there were open elements
|
@ -0,0 +1,74 @@
|
||||
|
||||
x Document
|
||||
,-[$DIR/tests/recovery/element/rt/input.html:1:1]
|
||||
1 | <!doctype html><ruby><div><p><rt>
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/rt/input.html:1:1]
|
||||
1 | <!doctype html><ruby><div><p><rt>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x DocumentType
|
||||
,-[$DIR/tests/recovery/element/rt/input.html:1:1]
|
||||
1 | <!doctype html><ruby><div><p><rt>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
|
||||
x Element
|
||||
|
||||
x Child
|
||||
|
||||
x Element
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/rt/input.html:1:1]
|
||||
1 | <!doctype html><ruby><div><p><rt>
|
||||
: ^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/recovery/element/rt/input.html:1:1]
|
||||
1 | <!doctype html><ruby><div><p><rt>
|
||||
: ^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/rt/input.html:1:1]
|
||||
1 | <!doctype html><ruby><div><p><rt>
|
||||
: ^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/recovery/element/rt/input.html:1:1]
|
||||
1 | <!doctype html><ruby><div><p><rt>
|
||||
: ^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/rt/input.html:1:1]
|
||||
1 | <!doctype html><ruby><div><p><rt>
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/recovery/element/rt/input.html:1:1]
|
||||
1 | <!doctype html><ruby><div><p><rt>
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/rt/input.html:1:1]
|
||||
1 | <!doctype html><ruby><div><p><rt>
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/recovery/element/rt/input.html:1:1]
|
||||
1 | <!doctype html><ruby><div><p><rt>
|
||||
: ^^^^
|
||||
`----
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user