mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #10757 - ineol:root-node, r=Ms2ger
Implement Node::rootNode Fixes #10747. I don't know whether it's OK to recurse up the tree, though it is a tail call. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10757) <!-- Reviewable:end -->
This commit is contained in:
commit
82938547ed
4 changed files with 7 additions and 66 deletions
|
@ -1858,6 +1858,11 @@ impl NodeMethods for Node {
|
|||
}
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-node-rootnode
|
||||
fn RootNode(&self) -> Root<Node> {
|
||||
self.inclusive_ancestors().last().unwrap()
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-node-parentnode
|
||||
fn GetParentNode(&self) -> Option<Root<Node>> {
|
||||
self.parent_node.get()
|
||||
|
|
|
@ -31,6 +31,8 @@ interface Node : EventTarget {
|
|||
[Pure]
|
||||
readonly attribute Document? ownerDocument;
|
||||
[Pure]
|
||||
readonly attribute Node rootNode;
|
||||
[Pure]
|
||||
readonly attribute Node? parentNode;
|
||||
[Pure]
|
||||
readonly attribute Element? parentElement;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue