W3C home > Mailing lists > Public > public-html@w3.org > April 2011

Browser inconsistencies in implementing name getters on forms and form element collections

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Thu, 14 Apr 2011 09:46:24 -0400
Message-ID: <4DA6FAB0.7000507@mit.edu>
To: HTML WG <public-html@w3.org>
Consider the following testcase:

   <!DOCTYPE html>
   <form name="x">
     <img name="y">

The results are as follows:

IE9: alerts undefined twice (in both standards and quirks mode
      as far as I can tell).
Opera 11: alerts [object HTMLImageElement], then undefined
Firefox: alerts [object HTMLImageElement], then undefined
Chrome: alerts [object HTMLImageElement] twice
Safari: alerts [object HTMLImageElement] twice

Chrome and Safari are consistent with what the spec currently says for 
the namegetter on HTMLFormElement, but not with the behavior specified 
for form.elements.

Opera and Firefox do what the spec currently says for form.elements, but 
not for HTMLFormElement.

IE currently does what the spec currently says.

I'm pretty sure I've seen code in the past that switches on "IE vs 
Netscape" and uses form.x for the latter while using getElementById for 
the former, but that was a good long while ago.  So I think we're 
willing to risk the compat hit in Gecko of changing to the currently 
specced behavior (which will incidentaly be simpler than what we do 
now).  Are Opera and WebKit willing to do that too?  Or does the spec 
need to change?

Received on Thursday, 14 April 2011 13:46:52 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 9 October 2021 18:45:36 UTC