Summary: | div.classList.add('a', 'a') creates duplicate entries | ||
---|---|---|---|
Product: | WebKit | Reporter: | Michał Gołębiowski-Owczarek <m.goleb+bugzilla> |
Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | andrea.giammarchi |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | All | ||
OS: | All | ||
URL: | http://jsfiddle.net/m_gol/xje3k/ |
Description
Michał Gołębiowski-Owczarek
2013-03-04 05:56:32 PST
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. |