[whatwg] getElementsByClassName()

Jonathan Worent jworent at yahoo.com
Mon Oct 23 10:25:47 PDT 2006


There seems to be a question on how confusing a method would be for developers. I went and asked 4
people I know that are just learning Javascript for the first time. For two of them javascript is
their first programing language, the other two already know other languages.

Given this markup:
<p class="foo bar">Para 1</p>
<p class="bar foo">Para 2</p>
<p class="foo baz">Para 3</p>

All expected that getElementsByClassName("foo bar"); would match "foo bar" exactly in the class
name and only return Para 1.

When asked if they would prefer a comma separated list or an array, there were mixed feelings.
Three indicated a preference to a comma separated list, the other said he would expect to pass an
array. 

Given this I would suggest not using a space delimited list. 


_  Jonathan Worent  _
      Webmaster

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the whatwg mailing list