Implement NonDocumentTypeChildNode::*ElementSibling()

This commit is contained in:
Anthony Ramine 2015-04-08 22:30:54 +02:00
parent f8d0237956
commit 3d68a46fee
12 changed files with 44 additions and 141 deletions

View file

@ -415,6 +415,7 @@ pub trait NodeHelpers<'a> {
fn rev_children(self) -> ReverseChildrenIterator;
fn child_elements(self) -> ChildElementIterator;
fn following_siblings(self) -> NodeChildrenIterator;
fn preceding_siblings(self) -> ReverseChildrenIterator;
fn is_in_doc(self) -> bool;
fn is_inclusive_ancestor_of(self, parent: JSRef<Node>) -> bool;
fn is_parent_of(self, child: JSRef<Node>) -> bool;
@ -764,6 +765,12 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
}
}
fn preceding_siblings(self) -> ReverseChildrenIterator {
ReverseChildrenIterator {
current: self.prev_sibling(),
}
}
fn is_parent_of(self, child: JSRef<Node>) -> bool {
match child.parent_node() {
Some(ref parent) if parent == &Temporary::from_rooted(self) => true,