Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / getElementsByClassName / dumpNodeList.html
blobbbeb3e3b6b524429a2f4809e4201c6d76e1fbec4
1 <html>
2 <body>
3 <div class="one">Line 1<div class="two">Line 2</div><p>Line <i>3</i></p></div>
4 <div id="test" class="one two"><div class="one two">line 4</div><p class="two">line 5</p></div>
5 <p><ol id="console"></ol></p>
6 <script type="text/javascript">
7 if (window.testRunner)
8 testRunner.dumpAsText();
10 function log(message)
12 var item = document.createElement("li");
13 item.appendChild(document.createTextNode(message));
14 document.getElementById("console").appendChild(item);
17 HTMLCollection.prototype.dump = function()
19 var result = "";
20 var i = 0;
21 for (; i < this.length; i++)
22 result += this[i] + ", ";
23 result += "length: " + i;
24 return result;
27 try {
28 var elm = document.getElementById("test");
30 log(document.getElementsByClassName("one").dump());
31 log(document.getElementsByClassName("two").dump());
32 log(document.getElementsByClassName("one two").dump());
33 log(document.getElementsByClassName("one\t\t\n \ftwo").dump());
34 log(document.getElementsByClassName("").dump());
35 log(document.getElementsByClassName("onetwo").dump());
36 log(document.getElementsByClassName(null).dump());
37 log(document.getElementsByClassName(undefined).dump());
39 log(elm.getElementsByClassName("one").dump());
40 log(elm.getElementsByClassName("two").dump());
41 log(elm.getElementsByClassName("one two").dump());
42 log(elm.getElementsByClassName("one\t\t\n \ftwo").dump());
43 log(elm.getElementsByClassName("").dump());
44 log(elm.getElementsByClassName("onetwo").dump());
45 log(elm.getElementsByClassName(null).dump());
46 log(elm.getElementsByClassName(undefined).dump());
47 } catch (ex) {
48 log("Exception: " + ex.description);
50 </script>
51 </body>
52 </html>