Unify the way html5ever and xml5ever block on script elements (#36284)

Companion PR for https://github.com/servo/html5ever/pull/591

Testing: Covered by WPT
Part of https://github.com/servo/servo/issues/6414,
https://github.com/servo/servo/issues/24898, preparation for
https://github.com/servo/html5ever/pull/590

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2025-04-08 18:40:14 +02:00 committed by GitHub
parent ce4ca9ee98
commit 9af9507920
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 53 additions and 54 deletions

View file

@ -16,10 +16,10 @@ use encoding_rs::Encoding;
use html5ever::buffer_queue::BufferQueue;
use html5ever::tendril::fmt::UTF8;
use html5ever::tendril::{ByteTendril, StrTendril, TendrilSink};
use html5ever::tokenizer::TokenizerResult;
use html5ever::tree_builder::{ElementFlags, NextParserState, NodeOrText, QuirksMode, TreeSink};
use html5ever::tree_builder::{ElementFlags, NodeOrText, QuirksMode, TreeSink};
use html5ever::{Attribute, ExpandedName, LocalName, QualName, local_name, namespace_url, ns};
use hyper_serde::Serde;
use markup5ever::TokenizerResult;
use mime::{self, Mime};
use net_traits::request::RequestId;
use net_traits::{
@ -1356,15 +1356,6 @@ impl TreeSink for Sink {
}
}
fn complete_script(&self, node: &Dom<Node>) -> NextParserState {
if let Some(script) = node.downcast() {
self.script.set(Some(script));
NextParserState::Suspend
} else {
NextParserState::Continue
}
}
fn reparent_children(&self, node: &Dom<Node>, new_parent: &Dom<Node>) {
while let Some(ref child) = node.GetFirstChild() {
new_parent.AppendChild(child, CanGc::note()).unwrap();