W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2002

new "getElement..." method suggestion

From: Robert Cavicchio <rcavicchio@akonix.com>
Date: Fri, 27 Sep 2002 11:20:59 -0700
Message-ID: <E7C4080EE8C3A349A1C9D6F3B489F88F8EE694@Mail.akonix.com>
To: "'www-dom@w3.org'" <www-dom@w3.org>

I'm new to this list, so I apologize if this has been discussed before.  I
did a search of the archives and did not find anything about it.

It appears that there are currently two generic methods for retrieving
elements according to their identifiers, "getElementById" and
"getElementsByTagName".  One addition that would be very useful in HTML
files is "getElementsByClassName".

I sometimes use classes to filter elements for processing by a script, and
the current methods for finding such elements are inefficient.  If elements
with different tag names might have a particular class, one must enumerate
every element and check the "className" on each.  This is further encumbered
by the fact that any particular element might have multiple classes, so the
value obtained by "className" must be parsed to see if it contains the
specific class being searched for.  A "getElementsByClassName" method would
make such script code cleaner, and user agents could hopefully return this
information much faster.

********************
Rob Cavicchio
Akonix Systems, Inc.
rcavicchio@akonix.com
Received on Friday, 27 September 2002 14:21:24 GMT

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