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", "bar"]);
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?

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

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:45 UTC