| Index: third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/rootNode.html
|
| diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/rootNode.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/rootNode.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..77fe6abfa487db13b8b02dd4ef76790d6a307e3f
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/rootNode.html
|
| @@ -0,0 +1,82 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<head>
|
| +<meta charset=utf-8>
|
| +<title>Node.prototype.rootNode</title>
|
| +<link rel="help" href="https://dom.spec.whatwg.org/#dom-node-rootnode">
|
| +<script src="../../../../resources/testharness.js"></script>
|
| +<script src="../../../../resources/testharnessreport.js"></script>
|
| +</head>
|
| +<body>
|
| +<script>
|
| +
|
| +test(function () {
|
| + var element = document.createElement('div');
|
| + assert_equals(element.rootNode, element, 'rootNode on an element without a parent must return the element itself');
|
| +
|
| + var text = document.createTextNode('');
|
| + assert_equals(text.rootNode, text, 'rootNode on a text node without a parent must return the text node itself');
|
| +
|
| + var processingInstruction = document.createProcessingInstruction('target', 'data');
|
| + assert_equals(processingInstruction.rootNode, processingInstruction, 'rootNode on a processing instruction node without a parent must return the processing instruction node itself');
|
| +
|
| + assert_equals(document.rootNode, document, 'rootNode on a document node must return the document itself');
|
| +
|
| +}, 'rootNode attribute must return the context object when it does not have any parent');
|
| +
|
| +test(function () {
|
| + var parent = document.createElement('div');
|
| +
|
| + var element = document.createElement('div');
|
| + parent.appendChild(element);
|
| + assert_equals(element.rootNode, parent, 'rootNode on an element with a single ancestor must return the parent node');
|
| +
|
| + var text = document.createTextNode('');
|
| + parent.appendChild(text);
|
| + assert_equals(text.rootNode, parent, 'rootNode on a text node with a single ancestor must return the parent node');
|
| +
|
| + var processingInstruction = document.createProcessingInstruction('target', 'data');
|
| + parent.appendChild(processingInstruction)
|
| + assert_equals(processingInstruction.rootNode, parent, 'rootNode on a processing instruction node with a single ancestor must return the parent node');
|
| +
|
| +}, 'rootNode attribute must return the parent node of the context object when the context object has a single ancestor not in a document');
|
| +
|
| +test(function () {
|
| + var parent = document.createElement('div');
|
| + document.body.appendChild(parent);
|
| +
|
| + var element = document.createElement('div');
|
| + parent.appendChild(element);
|
| + assert_equals(element.rootNode, document, 'rootNode on an element inside a document must return the document');
|
| +
|
| + var text = document.createTextNode('');
|
| + parent.appendChild(text);
|
| + assert_equals(text.rootNode, document, 'rootNode on a text node inside a document must return the document');
|
| +
|
| + var processingInstruction = document.createProcessingInstruction('target', 'data');
|
| + parent.appendChild(processingInstruction)
|
| + assert_equals(processingInstruction.rootNode, document, 'rootNode on a processing instruction node inside a document must return the document');
|
| +}, 'rootNode attribute must return the document when a node is in document');
|
| +
|
| +test(function () {
|
| + var fragment = document.createDocumentFragment();
|
| + var parent = document.createElement('div');
|
| + fragment.appendChild(parent);
|
| +
|
| + var element = document.createElement('div');
|
| + parent.appendChild(element);
|
| + assert_equals(element.rootNode, fragment, 'rootNode on an element inside a document fragment must return the fragment');
|
| +
|
| + var text = document.createTextNode('');
|
| + parent.appendChild(text);
|
| + assert_equals(text.rootNode, fragment, 'rootNode on a text node inside a document fragment must return the fragment');
|
| +
|
| + var processingInstruction = document.createProcessingInstruction('target', 'data');
|
| + parent.appendChild(processingInstruction)
|
| + assert_equals(processingInstruction.rootNode, fragment,
|
| + 'rootNode on a processing instruction node inside a document fragment must return the fragment');
|
| +}, 'rootNode attribute must return a document fragment when a node is in the fragment');
|
| +
|
| +</script>
|
| +</body>
|
| +</html>
|
|
|