Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / collection-item.html
blob5bc8fb947503f67afe6ca9b7ab3eb5996b598cac
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <script src="../../resources/js-test.js"></script>
6 </head>
7 <body>
8 <div style="display: none">
9 <form id=a>
10 <input id=x>
11 <input name=z>
12 </form>
13 <form name=z>
14 <input id=x>
15 <input name=z>
16 <select>
17 <option id=o>a</option>
18 <option name=z>b</option>
19 <option>c</option>
20 </select>
21 </form>
22 <a href="http://c.example.org" id=c name=cc></a>
23 <a href="http://d.example.org" name=z></a>
24 </div>
25 <script>
27 description("HTMLCollection.item() shouldn't fallback to namedItem().");
29 function runTests(collection, expectedElement) {
30 shouldBe(collection + ".item(0)", expectedElement);
31 shouldBe(collection + ".item('0')", expectedElement);
32 shouldBe(collection + ".item('z')", expectedElement);
33 shouldBe(collection + ".item(undefined)", expectedElement);
34 shouldBe(collection + ".item(null)", expectedElement);
35 shouldBe(collection + ".item({a: 'blah'})", expectedElement);
36 shouldBe(collection + ".item(false)", expectedElement);
37 shouldBe(collection + ".item(true)", collection + ".item(1)");
38 shouldBe(collection + ".item(4294967297)", collection + ".item(1)");
39 shouldBeNull(collection + ".item(10000)");
40 shouldBeNull(collection + ".item(-1)");
43 runTests("document.forms", "document.getElementById('a')");
44 runTests("document.forms[0].elements", "document.getElementById('x')");
45 runTests("document.forms[1].elements[2].options", "document.getElementById('o')");
46 runTests("document.anchors", "document.getElementById('c')");
48 // document.all is an ugly mutant (i.e. not an HTMLCollection).
50 if ("all" in document) {
51 shouldBe("document.all.item('z')[0]", "document.forms[0].elements.namedItem('z')");
52 shouldBe("document.all.item('z')[1]", "document.forms.namedItem('z')");
53 shouldBe("document.all.item('z')[2]", "document.forms.namedItem('z').elements.namedItem('z')");
56 </script>
57 </body>
58 </html>