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> |