Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / nodelist-item-parameter.html
blob46259803bad8da65ce8af9e623adef26fee04d26
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <link rel="help" href="http://www.w3.org/TR/2012/WD-dom-20121206/#dom-nodelist-item">
5 <script src="../../resources/js-test.js"></script>
6 </head>
7 <body>
8 <span id="target">
9 <div id="a"></div>
10 <div id="b"></div>
11 </span>
12 <script>
13 description("Tests that the NodeList.item() argument is correctly validated.");
15 var nodeList = document.getElementById("target").querySelectorAll('div');
16 shouldBe("nodeList.__proto__", "NodeList.prototype");
18 shouldBeEqualToString("nodeList.item(0).id", "a");
19 shouldBeEqualToString("nodeList.item(1).id", "b");
20 shouldBeNull("nodeList.item(2)");
21 shouldBeNull("nodeList.item(-1)");
22 shouldBeEqualToString("nodeList.item(-4294967295).id", "b"); // Wraps to 1.
23 shouldThrow("nodeList.item()", '"TypeError: Failed to execute \'item\' on \'NodeList\': 1 argument required, but only 0 present."');
24 </script>
25 </body>
26 </html>