Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / collection-length-should-not-be-overridden.html
blobff8ca404a4404d0b1b71aed1f72f3a5d8cdbdf74
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <div id="testElements">
5 <form>
6 <input type="text" name="some">
7 <input type="text" name="length">
8 </form>
9 <form>
10 <select>
11 <option name="length">
12 <option name="some">
13 </select>
14 </form>
15 <table>
16 <tbody>
17 <tr id="another"><td></td></tr>
18 <tr id="length"><td></td></tr>
19 </tbody>
20 </table>
21 </div>
22 <script>
24 // We need to pre-fetch these values since including the script element inserts new elements.
25 documentAllLength = document.all.length;
26 documentAllSome = document.all['some'];
27 documentAll5 = document.all[5];
28 documentAll6 = document.all[6];
30 </script>
31 <script src="../../resources/js-test.js"></script>
32 <script>
34 description("This test ensures the builtin length property of HTMLCollection's subclasses is not overridden by a named getter of the same name.");
36 var form = document.forms[0];
37 var select = document.querySelector('select');
38 var table = document.querySelector('table');
39 shouldBe("documentAllLength", "18");
40 shouldBe("documentAll5", "documentAllSome");
41 shouldBe("documentAll6.name", "'length'");
43 shouldBe("form.length", "form.elements[1]");
44 shouldBe("form.elements.length", "2");
45 shouldBe("form.elements[0]", "form.elements['some']");
46 shouldBe("form.elements[1].name", "'length'");
48 shouldBe("select.options.length", "2");
49 shouldBe("select.options[0].getAttribute('name')", "'length'");
50 shouldBe("select.options[1]", "select.options['some']");
52 shouldBe("table.rows.length", "2");
53 shouldBe("table.rows[0]", "table.rows['another']");
54 shouldBe("table.rows[1].id", "'length'");
56 document.getElementById('testElements').style.display = 'none';
58 var successfullyParsed = true;
60 </script>
61 </body>
62 </html>