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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <meta charset=utf-8>
3 <title>Node.childNodes</title>
4 <link rel=help href="https://dom.spec.whatwg.org/#dom-node-childnodes">
5 <link rel=author title="Tim Taubert" href="mailto:ttaubert@mozilla.com">
6 <link rel=author title="Ms2ger" href="mailto:Ms2ger@gmail.com">
7 <script src="../../../../resources/testharness.js"></script>
8 <script src="../../../../resources/testharnessreport.js"></script>
9 <div id="log"></div>
10 <script>
11 test(function() {
12 var element = document.createElement("p");
13 assert_equals(element.childNodes, element.childNodes);
14 }, "Caching of Node.childNodes");
15
16 var check_parent_node = function(node) {
17 assert_array_equals(node.childNodes, []);
18
19 var children = node.childNodes;
20 var child = document.createElement("p");
21 node.appendChild(child);
22 assert_equals(node.childNodes, children);
23 assert_array_equals(children, [child]);
24 assert_equals(children.item(0), child);
25
26 var child2 = document.createComment("comment");
27 node.appendChild(child2);
28 assert_array_equals(children, [child, child2]);
29 assert_equals(children.item(0), child);
30 assert_equals(children.item(1), child2);
31
32 assert_false(2 in children);
33 assert_equals(children[2], undefined);
34 assert_equals(children.item(2), null);
35 };
36
37 test(function() {
38 check_parent_node(document.createElement("p"));
39 }, "Node.childNodes on an Element.");
40
41 test(function() {
42 check_parent_node(document.createDocumentFragment());
43 }, "Node.childNodes on a DocumentFragment.");
44
45 test(function() {
46 check_parent_node(new Document());
47 }, "Node.childNodes on a Document.");
48 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698