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..4f60e9776c9e30cfd0f660ad613fbf4837fd21af |
--- /dev/null |
+++ b/LayoutTests/fast/dom/SelectorAPI/dumpNodeList-2.html |
@@ -0,0 +1,68 @@ |
+<!doctype html> |
haraken
2013/07/08 06:13:16
You can simplify the test by using js-test-pre.js
tasak
2013/07/08 09:46:18
Done.
|
+<html> |
+<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> |
+ if (window.testRunner) |
+ testRunner.dumpAsText(); |
haraken
2013/07/08 06:13:16
This isn't needed.
tasak
2013/07/08 09:46:18
Done.
|
+ |
+ function log(message) |
haraken
2013/07/08 06:13:16
Ditto.
tasak
2013/07/08 09:46:18
Done.
|
+ { |
+ document.getElementById('console').appendChild(document.createTextNode(message + "\n")); |
+ } |
+ |
+ Element.prototype.dump = function() |
+ { |
+ return this; |
+ } |
+ |
+ 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; |
+ } |
+ |
+ testQuerySelectorAll = function(node, selectorString) |
+ { |
+ try { |
+ log(node.querySelectorAll(selectorString).dump()); |
+ } catch (e) { |
+ log(e); |
+ } |
+ } |
+ |
+ log("Document.querySelectorAll"); |
+ log(""); |
+ |
+ testQuerySelectorAll(document, ".target + div"); |
+ |
+ log(""); |
+ log("Element.querySelectorAll"); |
+ log(""); |
+ |
+ testQuerySelectorAll(document.getElementById('test'), ".target + div"); |
+ testQuerySelectorAll(document.getElementById('test2'), ".target + div"); |
+ testQuerySelectorAll(document.getElementById('test3'), ".target + div"); |
+ |
+</script> |
+</body> |
+</html> |