diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index c23eaa6f680..3491a8ed20e 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -1778,6 +1778,14 @@ impl TreeIterator { self.current = Some(next_sibling); return Some(current); } + if let Some(shadow_root) = ancestor.downcast::() { + // Shadow roots don't have sibling, so after we're done traversing + // one we jump to the first child of the host + if let Some(child) = shadow_root.Host().upcast::().GetFirstChild() { + self.current = Some(child); + return Some(current); + } + } self.depth -= 1; } debug_assert_eq!(self.depth, 0); @@ -1801,8 +1809,6 @@ impl Iterator for TreeIterator { self.current = Some(DomRoot::from_ref(shadow_root.upcast::())); self.depth += 1; return Some(current); - } else { - return self.next_skipping_children_impl(current); } } } diff --git a/tests/wpt/meta/custom-elements/CustomElementRegistry.html.ini b/tests/wpt/meta/custom-elements/CustomElementRegistry.html.ini index 7b862b2d71c..bc33a16c596 100644 --- a/tests/wpt/meta/custom-elements/CustomElementRegistry.html.ini +++ b/tests/wpt/meta/custom-elements/CustomElementRegistry.html.ini @@ -1,6 +1,3 @@ [CustomElementRegistry.html] - [customElements.define must upgrade elements in the shadow-including tree order] - expected: FAIL - [customElements.define must get "observedAttributes" property on the constructor prototype when "attributeChangedCallback" is present] expected: FAIL diff --git a/tests/wpt/meta/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-in-slot.html.ini b/tests/wpt/meta/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-in-slot.html.ini deleted file mode 100644 index 4ed1ce5159e..00000000000 --- a/tests/wpt/meta/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-in-slot.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[legend-in-slot.html] - expected: FAIL diff --git a/tests/wpt/meta/html/semantics/embedded-content/the-canvas-element/canvas-descendants-focusability-004.tentative.html.ini b/tests/wpt/meta/html/semantics/embedded-content/the-canvas-element/canvas-descendants-focusability-004.tentative.html.ini index 5316effdce5..1900b9aedd1 100644 --- a/tests/wpt/meta/html/semantics/embedded-content/the-canvas-element/canvas-descendants-focusability-004.tentative.html.ini +++ b/tests/wpt/meta/html/semantics/embedded-content/the-canvas-element/canvas-descendants-focusability-004.tentative.html.ini @@ -1,2 +1,15 @@ [canvas-descendants-focusability-004.tentative.html] - expected: TIMEOUT + [