mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Implement Element#closest
fixes #4603 - Add definition to the Element.webidl and implementation to element.rs. - Create inclusive_ancestors helper in NodeHelpers - Update test expectations
This commit is contained in:
parent
2a9acdcb73
commit
7759358e09
6 changed files with 27 additions and 83 deletions
|
@ -397,6 +397,7 @@ impl<'a> Iterator<JSRef<'a, Node>> for QuerySelectorIterator<'a> {
|
|||
|
||||
pub trait NodeHelpers<'a> {
|
||||
fn ancestors(self) -> AncestorIterator<'a>;
|
||||
fn inclusive_ancestors(self) -> AncestorIterator<'a>;
|
||||
fn children(self) -> NodeChildrenIterator<'a>;
|
||||
fn rev_children(self) -> ReverseChildrenIterator;
|
||||
fn child_elements(self) -> ChildElementIterator<'a>;
|
||||
|
@ -798,6 +799,12 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
|
|||
}
|
||||
}
|
||||
|
||||
fn inclusive_ancestors(self) -> AncestorIterator<'a> {
|
||||
AncestorIterator {
|
||||
current: Some(self.clone())
|
||||
}
|
||||
}
|
||||
|
||||
fn owner_doc(self) -> Temporary<Document> {
|
||||
self.owner_doc.get().unwrap()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue