[whatwg] getElementsByClassName()

Gervase Markham gerv at mozilla.org
Tue Oct 24 02:20:01 PDT 2006


Dean Edwards wrote:
> var menus = document.getElementsByClassName("menu");
> 
> That is much more intuitive for the most common case.

Why not allow a string in the single class name case, but require an 
array for multiple class names?

Alternatively, we could make it more obvious that it takes an array by 
calling it
document.getElementsByClassNames(["...", "..."]);
This gives a little hint, and is a more accurate description of what the 
function does.

Gerv




More information about the whatwg mailing list