3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/console-test.js"></script>
7 function logToConsole()
9 var formElement = document.getElementById("f");
10 var selectElement = document.getElementById("sel");
11 var spanElement = document.getElementById("span");
14 var nodelist = document.getElementsByTagName("select");
15 console.log(nodelist);
18 var htmlcollection = document.head.children;
19 console.log(htmlcollection);
21 // HTMLOptionsCollection
22 var options = selectElement.options;
26 var all = document.all;
29 // HTMLFormControlsCollection (currently shows HTMLCollection)
30 var formControls = formElement.elements;
31 console.log(formControls);
34 var radioNodeList = formElement.x;
35 console.log(radioNodeList);
37 // Cross-referencing arrays.
39 var arrayY = [2, arrayX];
43 var nonArray = new NonArrayWithLength();
44 console.log(nonArray);
47 function generateArguments(foo, bar)
51 console.log(generateArguments(1, "2"));
54 var div = document.getElementsByTagName("div")[0];
55 console.log(div.classList);
58 console.log(new ArrayLike(5));
59 console.log(new ArrayLike(0xFFFFFFFF));
60 // Array-like's with wrong length.
61 console.log(new ArrayLike(-5));
62 console.log(new ArrayLike(5.6));
63 console.log(new ArrayLike(NaN));
64 console.log(new ArrayLike(Infinity));
65 console.log(new ArrayLike(-0));
66 console.log(new ArrayLike(0xFFFFFFFF + 1));
75 function NonArrayWithLength()
80 NonArrayWithLength.prototype.__defineGetter__("length", function()
82 console.log("FAIL: 'length' should not be called");
83 return this.keys.length;
86 function ArrayLike(length)
90 ArrayLike.prototype.splice = function() {};
94 InspectorTest.evaluateInPage("logToConsole()", callback);
98 InspectorTest.dumpConsoleMessages();
99 InspectorTest.completeTest();
105 <body onload="onload()">
107 Tests that console nicely formats HTML Collections, NodeLists and DOMTokenLists.
109 <div style="display:none" class="c1 c2 c3">
111 <select id="sel" name="sel">
112 <option value="1">one</option>
113 <option value="2">two</option>
115 <input type="radio" name="x" value="x1" /> x1
116 <input type="radio" name="x" value="x2" /> x2