mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Ignore children of void elements when serializing
This commit is contained in:
parent
d8b025c6cc
commit
f7db5743f4
2 changed files with 4 additions and 406 deletions
|
@ -153,6 +153,10 @@ struct SerializationIterator {
|
|||
}
|
||||
|
||||
fn rev_children_iter(n: &Node) -> impl Iterator<Item = DomRoot<Node>> {
|
||||
if n.downcast::<Element>().map_or(false, |e| e.is_void()) {
|
||||
return Node::new_document_node().rev_children();
|
||||
}
|
||||
|
||||
match n.downcast::<HTMLTemplateElement>() {
|
||||
Some(t) => t.Content().upcast::<Node>().rev_children(),
|
||||
None => n.rev_children(),
|
||||
|
@ -210,12 +214,6 @@ impl<'a> Serialize for &'a Node {
|
|||
) -> io::Result<()> {
|
||||
let node = *self;
|
||||
|
||||
if let TraversalScope::ChildrenOnly(_) = traversal_scope {
|
||||
if node.downcast::<Element>().map_or(false, |e| e.is_void()) {
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
let iter = SerializationIterator::new(node, traversal_scope != IncludeNode);
|
||||
|
||||
for cmd in iter {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue