diff --git a/components/script/dom/servoparser/html.rs b/components/script/dom/servoparser/html.rs index fe6d06064f4..106c6dc7261 100644 --- a/components/script/dom/servoparser/html.rs +++ b/components/script/dom/servoparser/html.rs @@ -10,6 +10,7 @@ use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::trace::JSTraceable; use crate::dom::characterdata::CharacterData; use crate::dom::document::Document; +use crate::dom::documentfragment::DocumentFragment; use crate::dom::documenttype::DocumentType; use crate::dom::element::Element; use crate::dom::htmlscriptelement::HTMLScriptElement; @@ -166,7 +167,7 @@ fn rev_children_iter(n: &Node) -> impl Iterator> { impl SerializationIterator { fn new(node: &Node, skip_first: bool) -> SerializationIterator { let mut ret = SerializationIterator { stack: vec![] }; - if skip_first { + if skip_first || node.is::() { for c in rev_children_iter(node) { ret.push_node(&*c); } diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index 0681b77f4ec..1a6432ba30b 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -642452,7 +642452,7 @@ "support" ], "domparsing/XMLSerializer-serializeToString.html": [ - "cb8ed9372df5e05588cbd593c40a8c13ee868bec", + "23b9ce841f5046f180ce78d92d7ac1132712f999", "testharness" ], "domparsing/createContextualFragment.html": [ diff --git a/tests/wpt/web-platform-tests/domparsing/XMLSerializer-serializeToString.html b/tests/wpt/web-platform-tests/domparsing/XMLSerializer-serializeToString.html index cb8ed9372df..23b9ce841f5 100644 --- a/tests/wpt/web-platform-tests/domparsing/XMLSerializer-serializeToString.html +++ b/tests/wpt/web-platform-tests/domparsing/XMLSerializer-serializeToString.html @@ -204,6 +204,14 @@ test(function() { assert_equals(serialize(root2), ''); }, 'Check if no special handling for XLink namespace unlike HTML serializer.'); +test(function() { + var root = new DocumentFragment; + root.append(document.createElement('div')); + root.append(document.createElement('span')); + assert_equals(serialize(root), '
'); +}, 'Check if document fragment serializes.'); + +