Re: getElementsByName should match any element

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.

To be clear, that's my personal opinion, not representing any sort of 
Mozilla consensus on this; Jonas might have his own opinion.  ;)

-Boris

Received on Wednesday, 10 June 2009 00:32:28 UTC