diff options
Diffstat (limited to 'LayoutTests/fast/dom/NodeList/nodelist-item-with-index.html')
-rw-r--r-- | LayoutTests/fast/dom/NodeList/nodelist-item-with-index.html | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/LayoutTests/fast/dom/NodeList/nodelist-item-with-index.html b/LayoutTests/fast/dom/NodeList/nodelist-item-with-index.html new file mode 100644 index 0000000..369e021 --- /dev/null +++ b/LayoutTests/fast/dom/NodeList/nodelist-item-with-index.html @@ -0,0 +1,38 @@ +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"> +<script src="../../js/resources/js-test-pre.js"></script> +</head> +<body> +<p id="description"></p> +<div id='div1'>text1</div> +<div id='div2'>text2</div><br> + +<div id="console"></div> + +<script> +description('This tests that items in a NodeList can be retrieved by index.'); + +var nodeList = document.getElementsByTagName('div'); +var div0 = nodeList[0]; +var div0s = nodeList["0"]; +var div0s_ = nodeList["0 "]; +var div1 = nodeList["1"]; + +// Getting properties 0 and "0" should get the same thing, but getting +// properties "0 " and 1 should get different items. "0 " should not +// be converted to 0, so should be undefined, and the item at index +// 1 should be defined (since there are at least two divs on the page), +// but should be a different div to the one at index 0. +shouldBeTrue("div0 == div0s"); +shouldBeFalse("div0 == div0s_"); +shouldBeFalse("div0 == div1"); +shouldBeFalse("div0s == div0s_"); +shouldBeFalse("div0s == div1"); +shouldBeFalse("div0s_ == div1"); + +var successfullyParsed = true; +</script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> |