Skip to content

Commit

Permalink
web/core: Handle </html> within body
Browse files Browse the repository at this point in the history
  • Loading branch information
simonwuelker committed Sep 21, 2023
1 parent c703538 commit bc912ce
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions web/core/src/html/treebuilding/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1492,10 +1492,24 @@ impl<P: ParseErrorHandler> Parser<P> {
self.insertion_mode = InsertionMode::AfterBody;
},

Token::Tag(ref tagdata)
if !tagdata.opening && tagdata.name == static_interned!("body") =>
Token::Tag(tagdata)
if !tagdata.opening && tagdata.name == static_interned!("html") =>
{
todo!()
// If the stack of open elements does not have a body element in scope, this is a parse error; ignore the token.
if self.is_element_in_scope(DOMType::HTMLBodyElement) {
return;
}

// Otherwise, if there is a node in the stack of open elements that is not either a dd element,
// a dt element, an li element, an optgroup element, an option element, a p element, an rb element,
// an rp element, an rt element, an rtc element, a tbody element, a td element, a tfoot element,
// a th element, a thead element, a tr element, the body element, or the html element, then this is a parse error.

// Switch the insertion mode to "after body".
self.insertion_mode = InsertionMode::AfterBody;

// Reprocess the token.
self.consume(Token::Tag(tagdata));
},
Token::Tag(ref tagdata)
if tagdata.opening
Expand Down

0 comments on commit bc912ce

Please sign in to comment.