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

[whatwg] getElementsByClassName()

From: Gervase Markham <gerv@mozilla.org>
Date: Fri, 03 Feb 2006 12:34:14 +0000
Message-ID: <43E34DC6.3080904@mozilla.org>
Shadow2531 wrote:
> O.K.  Then, it should be getElementByClassName*s*() where you have
> have 1 or more classname arguments.  If you pass more than 1 class
> name, both class names have to be present in the classname attribute
> for the element to match.

This seems like a sensible change. Call it getElementsByClassNames()
would make it obvious that if you supply multiple class names, you get
only elements with all those names. And it would be a reasonably obvious
reduction that if you just supply a single name, you would get all
elements which had that one class name.

So we've ended up with:

elem.getElementsByClassNames("foo");
and

elem.getElementsByClassNames(["foo", "bar"]);
or
elem.getElementsByClassNames("foo", "bar");
or both.

Are there similar functions in the DOM at the moment which can take
multiple arguments? Do you pass an array or multiple individual
arguments, or can you do both?

Gerv
Received on Friday, 3 February 2006 04:34:14 UTC

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