diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index f8ed845f7dd..f167b75a81d 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -982,8 +982,10 @@ impl Node { NeedsSelectorFlags::No, MatchingForInvalidation::No, ); - Ok(self - .traverse_preorder(ShadowIncluding::No) + let mut descendants = self.traverse_preorder(ShadowIncluding::No); + // Skip the root of the tree. + assert!(&*descendants.next().unwrap() == self); + Ok(descendants .filter_map(DomRoot::downcast) .find(|element| matches_selector_list(&selectors, element, &mut ctx))) }, diff --git a/tests/wpt/meta/dom/nodes/ParentNode-querySelector-scope.html.ini b/tests/wpt/meta/dom/nodes/ParentNode-querySelector-scope.html.ini index 6cc9f8bb118..67e3adb04e9 100644 --- a/tests/wpt/meta/dom/nodes/ParentNode-querySelector-scope.html.ini +++ b/tests/wpt/meta/dom/nodes/ParentNode-querySelector-scope.html.ini @@ -8,8 +8,5 @@ [querySelector with :scope] expected: FAIL - [querySelector with id and sibling] - expected: FAIL - [querySelectorAll with :scope] expected: FAIL diff --git a/tests/wpt/meta/dom/nodes/ParentNode-querySelectors-exclusive.html.ini b/tests/wpt/meta/dom/nodes/ParentNode-querySelectors-exclusive.html.ini deleted file mode 100644 index 9fff567e9f1..00000000000 --- a/tests/wpt/meta/dom/nodes/ParentNode-querySelectors-exclusive.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[ParentNode-querySelectors-exclusive.html] - [querySelector/querySelectorAll should not include their thisArg] - expected: FAIL -