This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
The DOMTokenList assumes that the underlying string is always "clean" in that it contains no spaces at the start and at the end or in between. However, in the case of HTML's class attribute, the string can be "dirty", in that the underlying string is derived from a the class attribute. Consider: element.className = " class1 \n class2 \t class3 \t \n" In order to get a clean string, the spec needs to define something the following, so whitespace is removed: //Splits the underlying string into a list of tokens function splitUnderlyingString() { var underString = this.toString(); var cleanString = underString.replace(/\s\s+/g, "\u0020").trim(); return cleanString.split("\u0020"); } Implementation already do the above, it seems. But the above is not clear in the spec.
The spec uses http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#split-a-string-on-spaces
(In reply to comment #1) > The spec uses > http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#split-a-string-on-spaces Ah, my bad. Didn't notice the "split" link.