[whatwg] classList should perhaps move from HTMLElement to Element

Ian Hickson ian at hixie.ch
Wed May 2 15:09:09 PDT 2012

On Fri, 19 Nov 2010, Boris Zbarsky wrote:
> Given that SVG also has classes, it would make some sense to move 
> classList from HTMLElement to Element.  That way SVG, and any other 
> languages that define classes (XUL comes to mind, actually) can benefit 
> from it as well.
> Note that Gecko's current classList implementation lives on Element.

How do you handle the difference between SVG and HTML's className? I think 
it would be confusing to have classList work the same on both but not 

(Currently, DOM Core and HTML both define classList; the former on Element 
and the latter on HTMLElement, because Anne and I disagree on what should 
happen here.)

For the spec's purposes my plan is to follow whatever implementations 
converge on. Currently WebKit does what the HTML/SVG specs say (.className 
is a string in HTML, an object in SVG, and .classList is HTML-specific), 
Gecko does a mixture of DOM Core and HTML/SVG say (.className is a string 
in HTML, an object in SVG, and .classList is on both but returns null in 
unknown namespaces), and Opera does a different mixture (.className is a 
string in HTML, an object in SVG, and .classList is on SVG and HTML nodes 
but not on nodes from unknown namespaces). (Didn't have other browsers 
available to test on this machine.)

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list