Bug 18407

Summary: document.images with multiple named items returns back a collection
Product: WebKit Reporter: Daniel Wester <daniel.wester>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED CONFIGURATION CHANGED    
Severity: Normal CC: ahmad.saleem792, ap, bfulgham, rniwa
Priority: P2    
Version: 525.x (Safari 3.1)   
Hardware: Mac   
OS: OS X 10.5   

Description Daniel Wester 2008-04-10 09:04:28 PDT
If you have the following on a page:
<img src="http://image1" name="myimage" />
<img src="http://image2" name="myimage" />

Then in javascript reference document.images['myimage']. In IE, Firefox and Opera this returns back a reference to one of the images. However Safari is returning back a Collection object. 

According to DOM Level 1 (HTML) http://www.w3.org/TR/REC-DOM-Level-1/level-one-html.html:
The Node with a name or id attribute whose value corresponds to the specified string. Upon failure (e.g., no node with this name exists), returns null.
Comment 1 Ahmad Saleem 2022-07-25 17:07:47 PDT
I am unable to reproduce this bug and I am not clear on web-spec and I get following behavior based on this test case (changed to JSFiddle from Comment 0):

Link - https://jsfiddle.net/atxj48fo/show

** Safari 15.6 on macOS 12.5 - <img src="http://image1" name="myimage">

** Firefox Nightly 104 - <img src="http://image1" name="myimage">

** Chrome Canary 106 - <img src="http://image1" name="myimage">

All of them are matching but not sure on web-spec so I am going to just share this much update. Thanks!