script: fix querySelector returning the root (#33174)

Signed-off-by: Nolan Lawson <nolan@nolanlawson.com>
This commit is contained in:
Nolan Lawson 2024-08-25 02:16:26 -07:00 committed by GitHub
parent c79d9e68a3
commit 67e2bb0ee6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 9 deletions

View file

@ -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)))
},

View file

@ -8,8 +8,5 @@
[querySelector with :scope]
expected: FAIL
[querySelector with id and sibling]
expected: FAIL
[querySelectorAll with :scope]
expected: FAIL

View file

@ -1,4 +0,0 @@
[ParentNode-querySelectors-exclusive.html]
[querySelector/querySelectorAll should not include their thisArg]
expected: FAIL