Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/Node-childNodes.html

Issue 1529523002: Import dom/ from web-platform-tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweak W3CImportExpectations Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/Node-childNodes.html
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/Node-childNodes.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/Node-childNodes.html
new file mode 100644
index 0000000000000000000000000000000000000000..d1458aa1922196de75a59ed7406ab1eb67e8c362
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/Node-childNodes.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Node.childNodes</title>
+<link rel=help href="https://dom.spec.whatwg.org/#dom-node-childnodes">
+<link rel=author title="Tim Taubert" href="mailto:ttaubert@mozilla.com">
+<link rel=author title="Ms2ger" href="mailto:Ms2ger@gmail.com">
+<script src="../../../../resources/testharness.js"></script>
+<script src="../../../../resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+test(function() {
+ var element = document.createElement("p");
+ assert_equals(element.childNodes, element.childNodes);
+}, "Caching of Node.childNodes");
+
+var check_parent_node = function(node) {
+ assert_array_equals(node.childNodes, []);
+
+ var children = node.childNodes;
+ var child = document.createElement("p");
+ node.appendChild(child);
+ assert_equals(node.childNodes, children);
+ assert_array_equals(children, [child]);
+ assert_equals(children.item(0), child);
+
+ var child2 = document.createComment("comment");
+ node.appendChild(child2);
+ assert_array_equals(children, [child, child2]);
+ assert_equals(children.item(0), child);
+ assert_equals(children.item(1), child2);
+
+ assert_false(2 in children);
+ assert_equals(children[2], undefined);
+ assert_equals(children.item(2), null);
+};
+
+test(function() {
+ check_parent_node(document.createElement("p"));
+}, "Node.childNodes on an Element.");
+
+test(function() {
+ check_parent_node(document.createDocumentFragment());
+}, "Node.childNodes on a DocumentFragment.");
+
+test(function() {
+ check_parent_node(new Document());
+}, "Node.childNodes on a Document.");
+</script>

Powered by Google App Engine
This is Rietveld 408576698