div.classList.add('a', 'a') should IMHO add only one instance of 'a' to div.classList.
One result of this issue is that results of invoking: div.classList.add(sth1, sth2); and: div.classList.add(sth1); div.classList.add(sth2); are different, which is unintuitive.
(In reply to comment #1) > One result of this issue is that results of invoking: > > div.classList.add(sth1, sth2); > > and: > > div.classList.add(sth1); > div.classList.add(sth2); > > are different, which is unintuitive. Correction: results CAN be different, not ARE different, of course.
OK, this is not only my view, this is what spec dictates: http://dom.spec.whatwg.org/#domtokenlist "A DOMTokenList object has an associated list of unique tokens, which is initially empty." So it's clearly WebKit's bug.
Chromium ticket: https://code.google.com/p/chromium/issues/detail?id=232448
confirmed and fixed/verified through the test 74 in here: http://webreflection.github.io/dom4/test/ The check is basically this one: div.classList.add('a', 'b', 'a'); assert(div.className === 'a b'); the test against to verify it works is the one showed here: div.classList.add('a', 'a'); assert(div.className === 'a'); Very weird this bus hasn't been confirmed yet since it's clearly stated about being unique tokens. What would be the reason to have twice the same class otherwise, having an `!important` effect ? Thanks for fixing this, I don't really want to rely on JS to fix such simple CSS classList core gotcha. Best Regards
The issue has been fixed in Chrome over two months ago, I also got some feedback in a sensible time after reporting. Meanwhile, here no one seems to bother. Could sb at least triage this? Important, not important, some milestone? This lack of response is disheartening.
I wish someone looked at those bug reports. :( Thankfully, this has been fixed in Safari 8.