Re: getElementsByName should match any element

On Tue, 9 Jun 2009, Boris Zbarsky wrote:
> Ian Hickson wrote:
> > What do other browser vendors want here? Should I not match IE?
> > 
> > (I definitely don't want to make it ignore the namespace. It's bad 
> > enough that we're considering making APIs that encourage screwing up 
> > HTML by sprinkling name="" attributes everywhere; we don't want to 
> > screw up SVG and MathML as well.)
> 
> I'd be fine with adding a namespace check here in Gecko.
> 
> I don't have a strong opinion on the other issue, but my general 
> thoughts are:
> 
> 1)  I wish this API just didn't exist.
> 2)  I sort of wish the name attribute did not exist.
> 3)  The fact that some nodes in HTML can be named and some can't,
>     and that which ones can is pretty arbitrary, is really silly.
> 4)  Doing a simple namespace check and name attribute check is a
>     lot faster than also checking whether the element is in the
>     "blessed with names" list.
> 
> Honestly, items 1, 2, 3 make me want to spend as little code as possible 
> on implementing this thing while retaining reasonable web compat (so not 
> just ripping it out altogether, sadly).  Item 4 suggests that "as little 
> code as possible" should be matching any element in the HTML namespace 
> with the right name attribute in the null namespace on it...
> 
> If the spec stays as it is, adding the namespace check will be a high 
> priority (in fact, see 
> https://bugzilla.mozilla.org/show_bug.cgi?id=497242), whereas doing the 
> rest of it will be pretty low priority, imo.  If nothing else because 
> doing it will likely entail nontrivial web compat issues.

On Wed, 10 Jun 2009, Simon Pieters wrote:
> 
> Sadly it seems that Web compat requires either doing what Gecko does 
> with getElementsByName, or doing what IE does in other areas, in this 
> case exposing .name on divs. I don't have data on how widespread this 
> issue is, but it has caused us to change from spec-compliant to 
> Gecko-compatible.

Ok, done. It's now all HTML elements with a matching name attribute.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Tuesday, 7 July 2009 23:26:05 UTC