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

Unified Diff: LayoutTests/fast/dom/Element/client-rect-list-argument.html

Issue 22191002: Make ClientRectList.item() argument mandatory and drop [IsIndex] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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/Element/client-rect-list-argument-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/dom/Element/client-rect-list-argument.html
diff --git a/LayoutTests/fast/dom/Element/client-rect-list-argument.html b/LayoutTests/fast/dom/Element/client-rect-list-argument.html
new file mode 100644
index 0000000000000000000000000000000000000000..9447ff0ea065f448768bd10a6e99016e5b8b380b
--- /dev/null
+++ b/LayoutTests/fast/dom/Element/client-rect-list-argument.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="help" href="http://dev.w3.org/csswg/cssom-view/#dom-clientrectlist-item">
+<script src="../../js/resources/js-test-pre.js"></script>
+<style>
+#testArea {
+ width: 300px;
+}
+#inner {
+ width: 200px;
+ height: 200px;
+}
+.testBox {
+ background-color: green;
+}
+</style>
+</head>
+<body>
+<div id="testArea">
+ <p>14. Block in inline</p> <span id="testElement" class="testBox">Lorem<div id="inner"></div>ipsum</span>
+</div>
+<script>
+description("Tests that the ClientRectList.item() argument is correctly validated.");
+
+var clientRects = document.getElementById("testElement").getClientRects();
+shouldBe("clientRects.__proto__", "ClientRectList.prototype");
+
+shouldBe("clientRects.length", "3");
+shouldNotBe("clientRects.item(0)", "null");
+shouldNotBe("clientRects.item(1)", "null");
+shouldNotBe("clientRects.item(2)", "null");
+shouldThrow("clientRects.item()", "'TypeError: Not enough arguments'");
+shouldBe("clientRects.item(-4294967294)", "clientRects.item(2)"); // -4294967294 wraps to 2.
+
+// According to the specification, we should throw an IndexSizeError exception when index is
+// greater than the number of ClientRect objects associated with the object.
+// However, we currently just return null like Firefox 22.
+shouldBeNull("clientRects.item(3)");
+shouldBeNull("clientRects.item(999)");
+shouldBeNull("clientRects.item(-1)");
+
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/fast/dom/Element/client-rect-list-argument-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698