Index: LayoutTests/fast/dom/nodelist-item-parameter.html |
diff --git a/LayoutTests/fast/dom/nodelist-item-parameter.html b/LayoutTests/fast/dom/nodelist-item-parameter.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1a3b19f50f924492dece66f7f9b44eff3ffd2f8e |
--- /dev/null |
+++ b/LayoutTests/fast/dom/nodelist-item-parameter.html |
@@ -0,0 +1,27 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<link rel="help" href="http://www.w3.org/TR/2012/WD-dom-20121206/#dom-nodelist-item"> |
+<script src="../js/resources/js-test-pre.js"></script> |
+</head> |
+<body> |
+<span id="target"> |
+ <div id="a"></div> |
+ <div id="b"></div> |
+</span> |
+<script> |
+description("Tests that the NodeList.item() argument is correctly validated."); |
+ |
+var nodeList = document.getElementById("target").querySelectorAll('div'); |
+shouldBe("nodeList.__proto__", "NodeList.prototype"); |
+ |
+shouldBeEqualToString("nodeList.item(0).id", "a"); |
+shouldBeEqualToString("nodeList.item(1).id", "b"); |
+shouldBeNull("nodeList.item(2)"); |
+shouldBeNull("nodeList.item(-1)"); |
+shouldBeEqualToString("nodeList.item(-4294967295).id", "b"); // Wraps to 1. |
+shouldThrow("nodeList.item()", "'TypeError: Not enough arguments'"); |
+</script> |
+<script src="../js/resources/js-test-post.js"></script> |
+</body> |
+</html> |