W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2006

[whatwg] getElementsByClassName()

From: Dean Edwards <dean@edwards.name>
Date: Tue, 07 Feb 2006 00:35:28 +0000
Message-ID: <43E7EB50.8010703@edwards.name>
Jim Ley wrote:
> That is not immediately apparent, and neither is it apparent that a
> classname specific shortname is worthwhile when a CSSSelector one
> would be more appropriate.    You don't continually add methods,
> methods are complexity, they need writing, they need testing etc.  you
> have to have a reason to add a method.
> 

A good API should expose a meaningful interface to its consumer. If we 
are allowed to define data according to a skew on its structure (HTML 
className) then the interface to that data should reflect this.

The getElementsByClassName() method has already been compared to the 
getElementsByTagName() and getElementById() methods. "class" is another 
way to slice the data. It is a core part of HTML, the language we are 
extending.

To me, getElementsByClassName() is a missing feature of the DOM to 
support HTML4. I'd be happy if that were fixed in HTML5.

Re CSSSelector: There are many ways to skin a cat. ;-)

-dean
Received on Monday, 6 February 2006 16:35:28 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:26 UTC