This test covers the various ways of accessing DOM elements through the document object by name, id or index, directly as properties of the document object. This lookup is supposed to include applet, embed, form, image, object and iframe by name, but only applet and object 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 exactly one item that is an iframe matches, it will give the window object for that iframe.

Our results match IE.

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): undefined
Image by id (multiple): undefined
Image by id/name mixed: collection(2) IMG(name) IMG(name)
Image by id, name present (unique): single IMG(id,name)
Image by id, empty name present (unique): single IMG(id)
Image by id, name present (multiple): collection(2) IMG(id,name) IMG(id,name)
Image by name, id present (unique): single IMG(id,name)

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): undefined
Form by id (multiple): undefined
Form by id/name mixed: collection(2) FORM(name) FORM(name)

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): undefined
Embed by id (multiple): undefined
Embed by id/name mixed: collection(2) EMBED(name) EMBED(name)

Nonexistent iframe name: undefined
Iframe by name (unique): single WINDOW
Iframe by name (multiple): collection(2) IFRAME(name) IFRAME(name)
Iframe by id (unique): undefined
Iframe by id (multiple): undefined
Iframe by id/name mixed: collection(2) IFRAME(name) IFRAME(name)

Nonexistent span name: undefined
Span by name (unique): undefined
Span by name (multiple): undefined
Span by id (unique): undefined
Span by id (multiple): undefined
Span by id/name mixed: undefined

Mixed by id: collection(2) APPLET(id) OBJECT(id)
Mixed by name: collection(6) IMG(name) FORM(name) APPLET(name) EMBED(name) OBJECT(name) IFRAME(name)
Mixed by id (no iframe): collection(2) APPLET(id) OBJECT(id)
Mixed by name (no iframe): collection(5) IMG(name) FORM(name) APPLET(name) EMBED(name) OBJECT(name)

Numeric 0: undefined
Numeric 12: undefined
Numeric 13: undefined

Conflicting image: single IMG(name)
Conflicting image (custom property): single IMG(name)
Conflicting iframe: single WINDOW

