mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Add NodeHelpers::inclusively_preceding_siblings()
This commit is contained in:
parent
c9a413cb6e
commit
9cee765c96
1 changed files with 7 additions and 0 deletions
|
@ -486,6 +486,7 @@ pub trait NodeHelpers<'a> {
|
|||
|
||||
fn traverse_preorder(self) -> TreeIterator<'a>;
|
||||
fn inclusively_following_siblings(self) -> NodeSiblingIterator;
|
||||
fn inclusively_preceding_siblings(self) -> ReverseSiblingIterator;
|
||||
|
||||
fn to_trusted_node_address(self) -> TrustedNodeAddress;
|
||||
|
||||
|
@ -754,6 +755,12 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
|
|||
}
|
||||
}
|
||||
|
||||
fn inclusively_preceding_siblings(self) -> ReverseSiblingIterator {
|
||||
ReverseSiblingIterator {
|
||||
current: Some(Temporary::from_rooted(self)),
|
||||
}
|
||||
}
|
||||
|
||||
fn is_inclusive_ancestor_of(self, parent: JSRef<Node>) -> bool {
|
||||
self == parent || parent.ancestors().any(|ancestor| ancestor.root().r() == self)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue