UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36
Steps to reproduce the problem:
var div = document.createElement('div');
div.className = ' a b c ';
div.classList.add('d');
console.log(div.className); // " a b c d"
What is the expected behavior?
What is the expected behavior?
`DOMTokenList` update steps' (https://dom.spec.whatwg.org/#domtokenlist) second point is:
"Set an attribute value for the associated element using associated attribute’s local name and the result of running the ordered set serializer for tokens."
For `classList` the "associated attribute's local name" is `class`. The "ordered set serializer" algorithm (https://dom.spec.whatwg.org/#concept-ordered-set-serializer) is:
"The ordered set serializer takes a set and returns the concatenation of the strings in set, separated from each other by U+0020". This means that after updating the context object's classes via the classList API, className value (that reflects the "class" attribute value) should be "a b c d", not " a b c d".
What went wrong?
The algorithm serializing the context object's classes preserves spaces too much.
Did this work before? No
Chrome version: 51.0.2700.0 Channel: canary
OS Version: OS X 10.11.4
Flash Version: Shockwave Flash 21.0 r0
It seems to me that the fix for the issue 526282 was applied only to the `remove` method of DOMTokenList while the normalization needs to be applied on any operations.
The problem applies not only to `add` but also to `remove` that removes a non-existing entry. For example:
var div = document.createElement('div');
div.className = ' a b c ';
div.classList.remove('d');
console.log(div.className); // This should log "a b c" but it logs the original value instead.
Safari has fixed all those issues in its Technical Preview.

tkent@, do you think you'll be doing the Blink code changes on this one, or someone on your team? ch.dumez@ (Apple), rbyers@ and I were discussing interop work in general and this issue came up. It might help resolve the spec-side issue sooner if Blink changed to the hoped-for end state, to be sure that the change will stick.

Tested the issue on Mac-10.12.4,Ubuntu-14.04 & windows-7 using chrome dev version#60.0.3112.7 with the steps mentioned in comment #0.Observed that the fix is working as expected. Hence adding TE-Verified labels.
Please find the attached screen cast for the same.
Thanks!!