Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / SelectorAPI / dumpNodeList-2.html
blob073145ddc246a0db15af916537d379041d73105e
1 <!doctype html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <div id="test">
8 <div></div>
9 <div>
10 <div class="target"></div>
11 </div>
12 <div>
13 <div class="target"></div>
14 <div></div>
15 </div>
16 <div id="test2" class="target">line 4</div>
17 <div id="test3"></div>
18 <p>line 5</p>
19 </div>
20 <pre id="console"></pre>
21 <script>
22 NodeList.prototype.dump = function()
24 var result = "";
25 var length = this.length;
26 for (var i = 0; i < length; i++)
27 result += this[i] + ", ";
28 result += "length: " + length;
29 return result;
32 function testQuerySelectorAll(node, selectorString)
34 try {
35 return node.querySelectorAll(selectorString).dump();
36 } catch (e) {
37 return "" + e;
41 shouldBeEqualToString('testQuerySelectorAll(document, ".target + div")', "[object HTMLDivElement], [object HTMLDivElement], length: 2");
42 shouldBeEqualToString('testQuerySelectorAll(document.getElementById("test"), ".target + div")', "[object HTMLDivElement], [object HTMLDivElement], length: 2");
43 shouldBeEqualToString('testQuerySelectorAll(document.getElementById("test2"), ".target + div")', "length: 0");
44 shouldBeEqualToString('testQuerySelectorAll(document.getElementById("test3"), ".target + div")', "length: 0");
45 </script>
46 </body>
47 </html>