Chromium Code Reviews| Index: LayoutTests/fast/dom/SelectorAPI/dumpNodeList-2.html |
| diff --git a/LayoutTests/fast/dom/SelectorAPI/dumpNodeList-2.html b/LayoutTests/fast/dom/SelectorAPI/dumpNodeList-2.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b29cd093ef771d1ec27075f652d0541817704f02 |
| --- /dev/null |
| +++ b/LayoutTests/fast/dom/SelectorAPI/dumpNodeList-2.html |
| @@ -0,0 +1,53 @@ |
| +<!doctype html> |
| +<html> |
| +<head> |
| +<script src="../../js/resources/js-test-pre.js"></script> |
| +</head> |
| +<body> |
| +<div id="test"> |
| + <div></div> |
| + <div> |
| + <div class="target"></div> |
| + </div> |
| + <div> |
| + <div class="target"></div> |
| + <div></div> |
| + </div> |
| + <div id="test2" class="target">line 4</div> |
| + <div id="test3"></div> |
| + <p>line 5</p> |
| +</div> |
| +<pre id="console"></pre> |
| +<script> |
| +Element.prototype.dump = function() |
| +{ |
| + return this; |
|
esprehn
2013/07/25 23:11:27
You don't call this anywhere.
tasak
2013/07/26 04:38:52
Done.
|
| +} |
| + |
| +NodeList.prototype.dump = function() |
| +{ |
| + var result = ""; |
| + var length = this.length; |
| + for (var i = 0; i < length; i++) |
| + result += this[i] + ", "; |
| + result += "length: " + length; |
| + return result; |
| +} |
| + |
| +function testQuerySelectorAll(node, selectorString) |
| +{ |
| + try { |
| + return node.querySelectorAll(selectorString).dump(); |
| + } catch (e) { |
| + return "" + e; |
| + } |
| +} |
| + |
| +shouldBeEqualToString('testQuerySelectorAll(document, ".target + div")', "[object HTMLDivElement], [object HTMLDivElement], length: 2"); |
| +shouldBeEqualToString('testQuerySelectorAll(document.getElementById("test"), ".target + div")', "[object HTMLDivElement], [object HTMLDivElement], length: 2"); |
| +shouldBeEqualToString('testQuerySelectorAll(document.getElementById("test2"), ".target + div")', "length: 0"); |
| +shouldBeEqualToString('testQuerySelectorAll(document.getElementById("test3"), ".target + div")', "length: 0"); |
| +</script> |
| +</body> |
| +<script src="../../js/resources/js-test-post.js"></script> |
| +</html> |