Re: getElementsByName

>Can I suggest that getElementsByName would be just as useful in other
>things (as well as HTML).

"Name" is not a defined concept that crosses all markup languages expected
to be processed through the DOM. It's quite HTML-specific.

We already have getElementsByNodeName.

DOM Level 3 will presumably introduce the ability to retrieve elements by
ID attribute, as part of the DTD/Schema support. A schema-specific set of
APIs could support Keys as well.

And of course you can always write a NodeFilter and plug it into a
TreeWalker or NodeIterator -- which may not be as highly optimized as the
above, but allows you the flexibility to define your own behaviors. Or --
assuming it survives into the REC and your DOM implements it -- try the
XPath API.

So there are lots of possible ways to address this use case in a more
general and portable manner. I don't see a need to add getElementsByName,
specifically, to the core DOM.


Now, if the SVG DOM APIs wanted to add this method to _their_ APIs, because
it was meaningful to them  -- more power to them.

______________________________________
Joe Kesselman  / IBM Research

Received on Monday, 11 February 2002 18:06:00 UTC