source: webkit/trunk/LayoutTests/fast/dom/HTMLDocument/document-special-properties.html

Last change on this file was 120792, checked in by rniwa@webkit.org, 13 years ago

Use testRunner instead of layoutTestController in fast/doctypes, dom, dynamic, encoding, events, eventsource, and exclusions tests
https://bugs.webkit.org/show_bug.cgi?id=89438

Reviewed by Tony Chang.

  • fast/doctypes/005-case-preserving.html:
  • fast/doctypes/doctype-after-comment.html:
  • fast/doctypes/doctype-at-end.html:
  • fast/doctypes/doctype-in-element.html:
  • fast/doctypes/doctype-parsing.html:
  • fast/doctypes/html-doctype.html:
  • fast/doctypes/xhtml-with-xhtmlmp-doctype.xhtml:
  • fast/doctypes/xml-doctype.xhtml:
  • fast/dom/:
  • fast/dynamic/5872671.html:
  • fast/dynamic/ancestor-to-absolute.html:
  • fast/dynamic/checkbox-selection-crash.html:
  • fast/dynamic/containing-block-change.html:
  • fast/dynamic/crash-generated-counter.html:
  • fast/dynamic/crash-generated-image.html:
  • fast/dynamic/crash-generated-quote.html:
  • fast/dynamic/crash-generated-text.html:
  • fast/dynamic/crash-paint-no-documentElement-renderer.html-disabled:
  • fast/dynamic/float-remove-above-line-2.html:
  • fast/dynamic/float-remove-above-line.html:
  • fast/dynamic/hover-before-position-after-style-change.html:
  • fast/dynamic/hover-before-position-after-style-change2.html:
  • fast/dynamic/hover-style-recalc-crash.html:
  • fast/dynamic/hovered-detach.html:
  • fast/dynamic/inline-to-block-crash.html:
  • fast/dynamic/insertAdjacentElement.html:
  • fast/dynamic/insertAdjacentHTML-allowed-parents.html:
  • fast/dynamic/insertAdjacentHTML.html:
  • fast/dynamic/insertAdjacentText.html:
  • fast/dynamic/jQuery-animation-crash.html:
  • fast/dynamic/layer-hit-test-crash.html:
  • fast/dynamic/layer-no-longer-paginated.html:
  • fast/dynamic/outerHTML-no-element.html:
  • fast/dynamic/paused-event-dispatch.html:
  • fast/dynamic/position-absolute-to-fixed-crash.html:
  • fast/dynamic/position-change-layout.html:
  • fast/dynamic/recursive-layout.html:
  • fast/dynamic/style-access-late-stylesheet-load.html:
  • fast/dynamic/subtree-common-root.html:
  • fast/dynamic/subtree-table-cell-height.html:
  • fast/dynamic/subtree-unrooted.html:
  • fast/encoding/:
  • fast/events/:
  • platform/chromium/fast/events/drag-downloadURL.html:
  • platform/chromium/fast/events/intercept-postmessage.html:
  • platform/chromium/fast/events/rtl-scrollbar.html:
  • platform/gtk/fast/events/event-sender-metakey.html:
  • platform/mac/fast/dom/HTMLImageElement/dashboard-src-quirk.html:
  • platform/mac/fast/dom/character-index-for-point.html:
  • platform/mac/fast/dom/objc-wrapper-identity.html:
  • platform/mac/fast/dom/wrapper-classes-objc.html:
  • platform/mac/fast/dom/wrapper-round-tripping.html:
  • platform/mac/fast/events/objc-event-api.html:
  • platform/mac/fast/events/objc-keyboard-event-creation.html:
  • platform/qt/fast/events/event-sender-keydown-frame.html:
  • platform/win/fast/events/alt-numpad.html:
  • platform/win/fast/events/alt-space-scroll.html:
  • platform/win/fast/events/double-dead-char.html:
  • platform/win/fast/events/keyLocation-numpad.html:
  • platform/win/fast/events/panScroll-correct-direction.html:
  • platform/win/fast/events/panScroll-event-fired.html:
  • platform/win/fast/events/panScroll-image-no-scroll.html:
  • platform/win/fast/events/panScroll-imageMap-href-no-scroll.html:
  • platform/win/fast/events/panScroll-imageMap-noHref-scroll.html:
  • platform/win/fast/events/panScroll-nested-divs.html:
  • platform/win/fast/events/panScroll-no-iframe-jump.html:
  • platform/win/fast/events/panScroll-preventDefault.html:
  • platform/win/fast/events/script-tests/context-click-events.js:
  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/html
File size: 9.7 KB
Line 
1<body>
2
3<p>This test covers the various ways of accessing DOM elements through
4the document object by name, id or index, directly as properties of
5the document object. This lookup is supposed to include applet, embed,
6form, image, object and iframe by name, but only applet and object by
7id. It should give the element itself in the case of a single match,
8or an HTMLCollection in the case of multiple matches; except that when
9exactly one item that is an iframe matches, it will give the window
10object for that iframe.
11</p>
12
13<p>Our results match IE.</p>
14
15<hr>
16
17<script>
18document.custom=new Object();
19
20if (window.testRunner)
21 window.testRunner.dumpAsText();
22</script>
23
24<div style="visibility: hidden; width: 0px; height: 0px;">
25<img name="image1" width="0" height="0">
26<img name="image2" width="0" height="0">
27<img name="image2" width="0" height="0">
28<img id="image3" width="0" height="0">
29<img id="image4" width="0" height="0">
30<img id="image4" width="0" height="0">
31<img id="image5" width="0" height="0">
32<img name="image5" width="0" height="0">
33<img name="image5" width="0" height="0">
34<img id="image5" width="0" height="0">
35<img id="image6" name="image6name" width="0" height="0">
36<img id="image7" name="" width="0" height="0">
37<img id="image8" name="image8name" width="0" height="0">
38<img id="image8" width="0" height="0">
39<img id="image8" name="image7name" width="0" height="0">
40<img id="image9" name="image9name" width="0" height="0">
41
42<form name="form1" width="0" height="0"></form>
43<form name="form2" width="0" height="0"></form>
44<form name="form2" width="0" height="0"></form>
45<form id="form3" width="0" height="0"></form>
46<form id="form4" width="0" height="0"></form>
47<form id="form4" width="0" height="0"></form>
48<form id="form5" width="0" height="0"></form>
49<form name="form5" width="0" height="0"></form>
50<form name="form5" width="0" height="0"></form>
51<form id="form5" width="0" height="0"></form>
52
53<applet name="applet1" width="0" height="0"></applet>
54<applet name="applet2" width="0" height="0"></applet>
55<applet name="applet2" width="0" height="0"></applet>
56<applet id="applet3" width="0" height="0"></applet>
57<applet id="applet4" width="0" height="0"></applet>
58<applet id="applet4" width="0" height="0"></applet>
59<applet id="applet5" width="0" height="0"></applet>
60<applet name="applet5" width="0" height="0"></applet>
61<applet name="applet5" width="0" height="0"></applet>
62<applet id="applet5" width="0" height="0"></applet>
63
64<embed name="embed1" width="0" height="0"></embed>
65<embed name="embed2" width="0" height="0"></embed>
66<embed name="embed2" width="0" height="0"></embed>
67<embed id="embed3" width="0" height="0"></embed>
68<embed id="embed4" width="0" height="0"></embed>
69<embed id="embed4" width="0" height="0"></embed>
70<embed id="embed5" width="0" height="0"></embed>
71<embed name="embed5" width="0" height="0"></embed>
72<embed name="embed5" width="0" height="0"></embed>
73<embed id="embed5" width="0" height="0"></embed>
74<object name="embed6"><embed name="embed6"></embed></object>
75
76<object name="object1" width="0" height="0"></object>
77<object name="object2" width="0" height="0"></object>
78<object name="object2" width="0" height="0"></object>
79<object id="object3" width="0" height="0"></object>
80<object id="object4" width="0" height="0"></object>
81<object id="object4" width="0" height="0"></object>
82<object id="object5" width="0" height="0"></object>
83<object name="object5" width="0" height="0"></object>
84<object name="object5" width="0" height="0"></object>
85<object id="object5" width="0" height="0"></object>
86
87<iframe name="iframe1" width="0" height="0"></iframe>
88<iframe name="iframe2" width="0" height="0"></iframe>
89<iframe name="iframe2" width="0" height="0"></iframe>
90<iframe id="iframe3" width="0" height="0"></iframe>
91<iframe id="iframe4" width="0" height="0"></iframe>
92<iframe id="iframe4" width="0" height="0"></iframe>
93<iframe id="iframe5" width="0" height="0"></iframe>
94<iframe name="iframe5" width="0" height="0"></iframe>
95<iframe name="iframe5" width="0" height="0"></iframe>
96<iframe id="iframe5" width="0" height="0"></iframe>
97
98<span name="span1" width="0" height="0"></span>
99<span name="span2" width="0" height="0"></span>
100<span name="span2" width="0" height="0"></span>
101<span id="span3" width="0" height="0"></span>
102<span id="span4" width="0" height="0"></span>
103<span id="span4" width="0" height="0"></span>
104<span id="span5" width="0" height="0"></span>
105<span name="span5" width="0" height="0"></span>
106<span name="span5" width="0" height="0"></span>
107<span id="span5" width="0" height="0"></span>
108
109<img id="mixed1" width="0" height="0">
110<form id="mixed1" width="0" height="0"></form>
111<applet id="mixed1" width="0" height="0"></applet>
112<embed id="mixed1" width="0" height="0"></embed>
113<object id="mixed1" width="0" height="0"></object>
114<iframe id="mixed1" width="0" height="0"></iframe>
115<span id="mixed1" width="0" height="0"></span>
116
117<img name="mixed2" width="0" height="0">
118<form name="mixed2" width="0" height="0"></form>
119<applet name="mixed2" width="0" height="0"></applet>
120<embed name="mixed2" width="0" height="0"></embed>
121<object name="mixed2" width="0" height="0"></object>
122<iframe name="mixed2" width="0" height="0"></iframe>
123<span name="mixed2" width="0" height="0"></span>
124
125<img id="mixed3" width="0" height="0">
126<form id="mixed3" width="0" height="0"></form>
127<applet id="mixed3" width="0" height="0"></applet>
128<embed id="mixed3" width="0" height="0"></embed>
129<object id="mixed3" width="0" height="0"></object>
130<span id="mixed3" width="0" height="0"></span>
131
132<img name="mixed4" width="0" height="0">
133<form name="mixed4" width="0" height="0"></form>
134<applet name="mixed4" width="0" height="0"></applet>
135<embed name="mixed4" width="0" height="0"></embed>
136<object name="mixed4" width="0" height="0"></object>
137<span name="mixed4" width="0" height="0"></span>
138
139<img name="body" with="0" height="0">
140<img name="custom" with="0" height="0">
141<iframe name="location" with="0" height="0"></iframe>
142
143</div>
144
145<pre id="results">
146Results:<br>
147</pre>
148
149<script>
150function print(x)
151{
152 document.getElementById("results").innerHTML += x;
153}
154
155function printElement(e)
156{
157 if (e.tagName) {
158 print(" " + e.tagName);
159
160 if (e.name && e.id) {
161 print("(id,name)");
162 } else if (e.name) {
163 print("(name)");
164 } else if (e.id) {
165 print("(id)");
166 }
167 } else if (e.navigator) {
168 print(" WINDOW");
169 } else {
170 print(" OTHER");
171 }
172}
173
174function testProperty(description, propName) {
175 print(description);
176 print(":");
177 var propVal = document[propName];
178
179 if (!propVal) {
180 print(" undefined");
181 } else if (propVal.length) {
182 print(" collection(" + propVal.length + ")");
183 for (var i = 0; i < propVal.length; i++) {
184 printElement(propVal[i]);
185 }
186 } else {
187 print(" single");
188 printElement(propVal);
189 }
190
191 print("<br>");
192}
193
194testProperty("Nonexistent image name", "image0");
195testProperty("Image by name (unique)", "image1");
196testProperty("Image by name (multiple)", "image2");
197testProperty("Image by id (unique)", "image3");
198testProperty("Image by id (multiple)", "image4");
199testProperty("Image by id/name mixed", "image5");
200testProperty("Image by id, name present (unique)", "image6");
201testProperty("Image by id, empty name present (unique)", "image7");
202testProperty("Image by id, name present (multiple)", "image8");
203testProperty("Image by name, id present (unique)", "image9name");
204
205print("<br>");
206
207testProperty("Nonexistent form name", "form0");
208testProperty("Form by name (unique)", "form1");
209testProperty("Form by name (multiple)", "form2");
210testProperty("Form by id (unique)", "form3");
211testProperty("Form by id (multiple)", "form4");
212testProperty("Form by id/name mixed", "form5");
213print("<br>");
214
215testProperty("Nonexistent applet name", "applet0");
216testProperty("Applet by name (unique)", "applet1");
217testProperty("Applet by name (multiple)", "applet2");
218testProperty("Applet by id (unique)", "applet3");
219testProperty("Applet by id (multiple)", "applet4");
220testProperty("Applet by id/name mixed", "applet5");
221print("<br>");
222
223testProperty("Nonexistent object name", "object0");
224testProperty("Object by name (unique)", "object1");
225testProperty("Object by name (multiple)", "object2");
226testProperty("Object by id (unique)", "object3");
227testProperty("Object by id (multiple)", "object4");
228testProperty("Object by id/name mixed", "object5");
229print("<br>");
230
231testProperty("Nonexistent embed name", "embed0");
232testProperty("Embed by name (unique)", "embed1");
233testProperty("Embed by name (multiple)", "embed2");
234testProperty("Embed by id (unique)", "embed3");
235testProperty("Embed by id (multiple)", "embed4");
236testProperty("Embed by id/name mixed", "embed5");
237testProperty("Embed by name nested in object with the same name", "embed6");
238print("<br>");
239
240testProperty("Nonexistent iframe name", "iframe0");
241testProperty("Iframe by name (unique)", "iframe1");
242testProperty("Iframe by name (multiple)", "iframe2");
243testProperty("Iframe by id (unique)", "iframe3");
244testProperty("Iframe by id (multiple)", "iframe4");
245testProperty("Iframe by id/name mixed", "iframe5");
246print("<br>");
247
248testProperty("Nonexistent span name", "span0");
249testProperty("Span by name (unique)", "span1");
250testProperty("Span by name (multiple)", "span2");
251testProperty("Span by id (unique)", "span3");
252testProperty("Span by id (multiple)", "span4");
253testProperty("Span by id/name mixed", "span5");
254print("<br>");
255
256testProperty("Mixed by id", "mixed1");
257testProperty("Mixed by name", "mixed2");
258testProperty("Mixed by id (no iframe)", "mixed3");
259testProperty("Mixed by name (no iframe)", "mixed4");
260print("<br>");
261
262testProperty("Numeric 0", 0);
263testProperty("Numeric 12", 12);
264testProperty("Numeric 13", 13);
265print("<br>");
266
267testProperty("Conflicting image", "body");
268testProperty("Conflicting image (custom property)", "custom");
269testProperty("Conflicting iframe", "location");
270
271</script>
272</body>
Note: See TracBrowser for help on using the repository browser.