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

Unified Diff: LayoutTests/fast/dom/nodelist-item-parameter.html

Issue 21766002: NodeList.item() does not behave according to specification (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Simplify link tag Created 7 years, 5 months 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
« no previous file with comments | « no previous file | LayoutTests/fast/dom/nodelist-item-parameter-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | LayoutTests/fast/dom/nodelist-item-parameter-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698