Implement Node::rootNode

This commit is contained in:
Léo Stefanesco 2016-04-20 18:38:12 +02:00
parent 89b276c889
commit 00b3f7930e
4 changed files with 7 additions and 66 deletions

View file

@ -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 // https://dom.spec.whatwg.org/#dom-node-parentnode
fn GetParentNode(&self) -> Option<Root<Node>> { fn GetParentNode(&self) -> Option<Root<Node>> {
self.parent_node.get() self.parent_node.get()

View file

@ -32,6 +32,8 @@ interface Node : EventTarget {
[Pure] [Pure]
readonly attribute Document? ownerDocument; readonly attribute Document? ownerDocument;
[Pure] [Pure]
readonly attribute Node rootNode;
[Pure]
readonly attribute Node? parentNode; readonly attribute Node? parentNode;
[Pure] [Pure]
readonly attribute Element? parentElement; readonly attribute Element? parentElement;

View file

@ -165,9 +165,6 @@
[DOMTokenList interface: calling supports(DOMString) on document.body.classList with too few arguments must throw TypeError] [DOMTokenList interface: calling supports(DOMString) on document.body.classList with too few arguments must throw TypeError]
expected: FAIL expected: FAIL
[Node interface: attribute rootNode]
expected: FAIL
[Document interface: new Document() must inherit property "origin" with the proper type (3)] [Document interface: new Document() must inherit property "origin" with the proper type (3)]
expected: FAIL expected: FAIL
@ -183,30 +180,6 @@
[Document interface: calling queryAll(DOMString) on new Document() with too few arguments must throw TypeError] [Document interface: calling queryAll(DOMString) on new Document() with too few arguments must throw TypeError]
expected: FAIL expected: FAIL
[Node interface: new Document() must inherit property "rootNode" with the proper type (16)]
expected: FAIL
[Node interface: xmlDoc must inherit property "rootNode" with the proper type (16)]
expected: FAIL
[Node interface: document.createDocumentFragment() must inherit property "rootNode" with the proper type (16)]
expected: FAIL
[Node interface: document.doctype must inherit property "rootNode" with the proper type (16)]
expected: FAIL
[Node interface: element must inherit property "rootNode" with the proper type (16)]
expected: FAIL
[Node interface: document.createTextNode("abc") must inherit property "rootNode" with the proper type (16)]
expected: FAIL
[Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "rootNode" with the proper type (16)]
expected: FAIL
[Node interface: document.createComment("abc") must inherit property "rootNode" with the proper type (16)]
expected: FAIL
[Element interface: element must inherit property "query" with the proper type (36)] [Element interface: element must inherit property "query" with the proper type (36)]
expected: FAIL expected: FAIL
@ -222,9 +195,6 @@
[Node interface: new Document() must inherit property "isConnected" with the proper type (15)] [Node interface: new Document() must inherit property "isConnected" with the proper type (15)]
expected: FAIL expected: FAIL
[Node interface: new Document() must inherit property "rootNode" with the proper type (17)]
expected: FAIL
[Node interface: new Document() must inherit property "isSameNode" with the proper type (31)] [Node interface: new Document() must inherit property "isSameNode" with the proper type (31)]
expected: FAIL expected: FAIL
@ -234,9 +204,6 @@
[Node interface: xmlDoc must inherit property "isConnected" with the proper type (15)] [Node interface: xmlDoc must inherit property "isConnected" with the proper type (15)]
expected: FAIL expected: FAIL
[Node interface: xmlDoc must inherit property "rootNode" with the proper type (17)]
expected: FAIL
[Node interface: xmlDoc must inherit property "isSameNode" with the proper type (31)] [Node interface: xmlDoc must inherit property "isSameNode" with the proper type (31)]
expected: FAIL expected: FAIL
@ -246,9 +213,6 @@
[Node interface: document.doctype must inherit property "isConnected" with the proper type (15)] [Node interface: document.doctype must inherit property "isConnected" with the proper type (15)]
expected: FAIL expected: FAIL
[Node interface: document.doctype must inherit property "rootNode" with the proper type (17)]
expected: FAIL
[Node interface: document.doctype must inherit property "isSameNode" with the proper type (31)] [Node interface: document.doctype must inherit property "isSameNode" with the proper type (31)]
expected: FAIL expected: FAIL
@ -258,9 +222,6 @@
[Node interface: document.createDocumentFragment() must inherit property "isConnected" with the proper type (15)] [Node interface: document.createDocumentFragment() must inherit property "isConnected" with the proper type (15)]
expected: FAIL expected: FAIL
[Node interface: document.createDocumentFragment() must inherit property "rootNode" with the proper type (17)]
expected: FAIL
[Node interface: document.createDocumentFragment() must inherit property "isSameNode" with the proper type (31)] [Node interface: document.createDocumentFragment() must inherit property "isSameNode" with the proper type (31)]
expected: FAIL expected: FAIL
@ -321,9 +282,6 @@
[Node interface: element must inherit property "isConnected" with the proper type (15)] [Node interface: element must inherit property "isConnected" with the proper type (15)]
expected: FAIL expected: FAIL
[Node interface: element must inherit property "rootNode" with the proper type (17)]
expected: FAIL
[Node interface: element must inherit property "isSameNode" with the proper type (31)] [Node interface: element must inherit property "isSameNode" with the proper type (31)]
expected: FAIL expected: FAIL
@ -339,9 +297,6 @@
[Node interface: document.createTextNode("abc") must inherit property "isConnected" with the proper type (15)] [Node interface: document.createTextNode("abc") must inherit property "isConnected" with the proper type (15)]
expected: FAIL expected: FAIL
[Node interface: document.createTextNode("abc") must inherit property "rootNode" with the proper type (17)]
expected: FAIL
[Node interface: document.createTextNode("abc") must inherit property "isSameNode" with the proper type (31)] [Node interface: document.createTextNode("abc") must inherit property "isSameNode" with the proper type (31)]
expected: FAIL expected: FAIL
@ -351,9 +306,6 @@
[Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "isConnected" with the proper type (15)] [Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "isConnected" with the proper type (15)]
expected: FAIL expected: FAIL
[Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "rootNode" with the proper type (17)]
expected: FAIL
[Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "isSameNode" with the proper type (31)] [Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "isSameNode" with the proper type (31)]
expected: FAIL expected: FAIL
@ -363,9 +315,6 @@
[Node interface: document.createComment("abc") must inherit property "isConnected" with the proper type (15)] [Node interface: document.createComment("abc") must inherit property "isConnected" with the proper type (15)]
expected: FAIL expected: FAIL
[Node interface: document.createComment("abc") must inherit property "rootNode" with the proper type (17)]
expected: FAIL
[Node interface: document.createComment("abc") must inherit property "isSameNode" with the proper type (31)] [Node interface: document.createComment("abc") must inherit property "isSameNode" with the proper type (31)]
expected: FAIL expected: FAIL

View file

@ -1,15 +0,0 @@
[rootNode.html]
type: testharness
bug: https://github.com/servo/servo/issues/10747
[rootNode attribute must return the context object when it does not have any parent]
expected: FAIL
[rootNode attribute must return the parent node of the context object when the context object has a single ancestor not in a document]
expected: FAIL
[rootNode attribute must return the document when a node is in document]
expected: FAIL
[rootNode attribute must return a document fragment when a node is in the fragment]
expected: FAIL