mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
script: fix querySelector
returning the root (#33174)
Signed-off-by: Nolan Lawson <nolan@nolanlawson.com>
This commit is contained in:
parent
c79d9e68a3
commit
67e2bb0ee6
3 changed files with 4 additions and 9 deletions
|
@ -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)))
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue