blob: b0ff6a83edf169284f46c8a495d6b071b2ec175c [file] [log] [blame]
This test covers the various ways of accessing DOM elements through the window object by name, id or index, directly as properties of the window object. This lookup is supposed to include applet, embed, form, image and object by name, and all elements by id. It should give the element itself in the case of a single match, or an HTMLCollection in the case of multiple matches; except that when iframes are involved, it will give the window object for the first iframe match.
Our results match WinIE in all respects but one. We allow child frame names to take precedence over built-in and custom properties of the window object. This is the Mozilla behavior and is required to make some sites work because they use frame names that collide with built-in properties in Mozilla but not IE - specifically "toobar". See Radar 3870317.
Results:
Nonexistent image name: undefined
Image by name (unique): single IMG(name)
Image by name (multiple): collection(2) IMG(name) IMG(name)
Image by id (unique): single IMG(id)
Image by id (multiple): collection(2) IMG(id) IMG(id)
Image by id/name mixed: collection(4) IMG(id) IMG(name) IMG(name) IMG(id)
Nonexistent form name: undefined
Form by name (unique): single FORM(name)
Form by name (multiple): collection(2) FORM(name) FORM(name)
Form by id (unique): single FORM(id)
Form by id (multiple): collection(2) FORM(id) FORM(id)
Form by id/name mixed: collection(4) FORM(id) FORM(name) FORM(name) FORM(id)
Nonexistent applet name: undefined
Applet by name (unique): single APPLET(name)
Applet by name (multiple): collection(2) APPLET(name) APPLET(name)
Applet by id (unique): single APPLET(id)
Applet by id (multiple): collection(2) APPLET(id) APPLET(id)
Applet by id/name mixed: collection(4) APPLET(id) APPLET(name) APPLET(name) APPLET(id)
Nonexistent object name: undefined
Object by name (unique): single OBJECT(name)
Object by name (multiple): collection(2) OBJECT(name) OBJECT(name)
Object by id (unique): single OBJECT(id)
Object by id (multiple): collection(2) OBJECT(id) OBJECT(id)
Object by id/name mixed: collection(4) OBJECT(id) OBJECT(name) OBJECT(name) OBJECT(id)
Nonexistent embed name: undefined
Embed by name (unique): single EMBED(name)
Embed by name (multiple): collection(2) EMBED(name) EMBED(name)
Embed by id (unique): single EMBED(id)
Embed by id (multiple): collection(2) EMBED(id) EMBED(id)
Embed by id/name mixed: collection(4) EMBED(id) EMBED(name) EMBED(name) EMBED(id)
Nonexistent iframe name: undefined
Iframe by name (unique): single WINDOW
Iframe by name (multiple): single WINDOW
Iframe by id (unique): single IFRAME(id)
Iframe by id (multiple): collection(2) IFRAME(id) IFRAME(id)
Iframe by id/name mixed: single WINDOW
Nonexistent span name: undefined
Span by name (unique): undefined
Span by name (multiple): undefined
Span by id (unique): single SPAN(id)
Span by id (multiple): collection(2) SPAN(id) SPAN(id)
Span by id/name mixed: collection(2) SPAN(id) SPAN(id)
Mixed by id: collection(7) IMG(id) FORM(id) APPLET(id) EMBED(id) OBJECT(id) IFRAME(id) SPAN(id)
Mixed by name: single WINDOW
Mixed by id (no iframe): collection(6) IMG(id) FORM(id) APPLET(id) EMBED(id) OBJECT(id) SPAN(id)
Mixed by name (no iframe): collection(5) IMG(name) FORM(name) APPLET(name) EMBED(name) OBJECT(name)
Numeric 0: single WINDOW
Numeric 12: single WINDOW
Numeric 13: undefined
Conflicting image name: single OTHER
Conflicting image name (custom property): single OTHER
Conflicting iframe: single OTHER
Input by id (unique): single INPUT(id)
Conflicting input id (navigator): single OTHER
Conflicting input id (location): single OTHER