[whatwg] getElementsByClassName()

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