W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2002

Re: getElementsByName

From: Joseph Kesselman <keshlam@us.ibm.com>
Date: Mon, 11 Feb 2002 18:05:25 -0500
To: Jonathan Watt <0jaw@qlink.queensu.ca>
Cc: Boris Zbarsky <bzbarsky@MIT.EDU>, www-dom@w3.org
Message-ID: <OF4ADE7086.0C76674B-ON85256B5D.007E4916@pok.ibm.com>

>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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:55 GMT