WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
111307
div.classList.add('a', 'a') creates duplicate entries
https://bugs.webkit.org/show_bug.cgi?id=111307
Summary
div.classList.add('a', 'a') creates duplicate entries
Michał Gołębiowski-Owczarek
Reported
2013-03-04 05:56:32 PST
div.classList.add('a', 'a') should IMHO add only one instance of 'a' to div.classList.
Attachments
Add attachment
proposed patch, testcase, etc.
Michał Gołębiowski-Owczarek
Comment 1
2013-03-04 13:20:48 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.
Michał Gołębiowski-Owczarek
Comment 2
2013-03-04 13:23:39 PST
(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.
Michał Gołębiowski-Owczarek
Comment 3
2013-03-05 00:18:29 PST
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.
Michał Gołębiowski-Owczarek
Comment 4
2013-04-17 10:37:17 PDT
Chromium ticket:
https://code.google.com/p/chromium/issues/detail?id=232448
Andrea Giammarchi
Comment 5
2013-10-08 18:42:41 PDT
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
Michał Gołębiowski-Owczarek
Comment 6
2013-12-29 14:17:34 PST
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.
Michał Gołębiowski-Owczarek
Comment 7
2015-08-28 11:20:17 PDT
I wish someone looked at those bug reports. :( Thankfully, this has been fixed in Safari 8.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug