W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2005

[whatwg] getElementsByClassName()

From: Aankhen <aankhen@gmail.com>
Date: Mon, 5 Sep 2005 10:57:30 +0530
Message-ID: <ae697d05050904222734827bdc@mail.gmail.com>
On 9/5/05, Lachlan Hunt <lachlan.hunt at lachy.id.au> wrote:
> 1. Equivalent to ("foo", "bar") (or [class~=foo][class~=bar], or
>     .foo.bar in CSS)
> 2. The way it currently works. ie. matches "foo bar", not "bar foo"
> 3. Error, return nothing.

I suggest #2, which implies consistently treating the first argument
passed to the function as a single class name to match (this means
"foo bar" would always return no elements, since a class name
obviously cannot contain whitespace).  Special-casing "foo bar" and
other values seems to be adding complexity without much return.

If multiple class names really need to be handled, my suggestion would
be to take a single array as a parameter, e.g.
`getElementsByClassName(["foo"])` and `getElementsByClassName(["foo",
"bar"])`.

Aankhen
Received on Sunday, 4 September 2005 22:27:30 UTC

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