Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / dom / HTMLDocument / object-by-name-or-id.html
1 <body>
2
3 <p>This tests when object elements are accessible by name or id directly as properties of the
4 document object. A PASS result means that behavior matches IE and Firefox.
5 </p>
6
7 <hr>
8
9 <script>
10 if (window.testRunner)
11     window.testRunner.dumpAsText();
12 </script>
13
14 <div style="visibility: hidden; width: 0px; height: 0px;">
15 <object name="object1" width="0" height="0"></object>
16 <object name="object2" width="0" height="0"><param name="p" value="v"></object>
17 <object name="object5" width="0" height="0"><param name="p" value="v">    </object>
18 <object name="object9" width="0" height="0"><param name="p" value="v"><!-- --></object>
19 <object name="object11" width="0" height="0"><param name="p" value="v"><!-- comment --></object>
20 <object name="object6" width="0" height="0"><param name="p" value="v">text</object>
21 <object name="object13" width="0" height="0"><param name="p" value="v"><img width="0" height="0"></object>
22 <object id="object3" width="0" height="0"></object>
23 <object id="object4" width="0" height="0"><param name="p" value="v"></object>
24 <object id="object8" width="0" height="0"><param name="p" value="v">    </object>
25 <object id="object10" width="0" height="0"><param name="p" value="v"><!-- --></object>
26 <object id="object12" width="0" height="0"><param name="p" value="v"><!-- comment --></object>
27 <object id="object7" width="0" height="0"><param name="p" value="v">text</object>
28 <object id="object14" width="0" height="0"><param name="p" value="v"><img width="0" height="0"></object>
29 </div>
30
31 <pre id="results">
32 Results:<br>
33 </pre>
34
35 <script>
36 function print(x)
37 {
38    document.getElementById("results").innerHTML += x;
39 }
40
41 function testProperty(description, propName, IE) {
42     print(description);
43     print(":");
44     var propVal = document[propName];
45
46     print(!propVal == IE ? " FAIL" : " PASS");
47     print("<br>");
48 }
49
50 print("By name:<br>");
51 testProperty("no children", "object1", true);
52 testProperty("param", "object2", true);
53 testProperty("param and whitespace", "object5", true);
54 testProperty("param and empty comment", "object9", true);
55 testProperty("param and non-empty comment", "object11", true);
56 testProperty("param and text", "object6", true);
57 testProperty("param and img", "object13", true);
58 print("<br>By id:<br>");
59 testProperty("no children", "object3", true);
60 testProperty("param", "object4", true);
61 testProperty("param and whitespace", "object8", true);
62 testProperty("param and empty comment", "object10", true);
63 testProperty("param and non-empty comment", "object12", true);
64 testProperty("param and text", "object7", true);
65 testProperty("param and img", "object14", true);
66
67 </script>
68 </body>