Bugzilla – Bug 20105
Nothing in the spec really defines how changes to token lists change the underlying string
Last modified: 2012-12-07 13:17:46 UTC
In particular, I see the following problems:
1) It's not clear at what point token list mutators call setAttribute in the case of .classList. If I call remove("a", "b"), should that do two setAttribute calls or just one? The difference is content-detectable using mutation records.
2) Nothing really says that the underlying attribute is modified. For example, http://dom.spec.whatwg.org/#dom-domtokenlist-remove just calls into http://dom.spec.whatwg.org/#remove-a-token-from-a-string which produces a string called "output" and never does anything with it. So per spec as currently written, "output" should just be discarded, which is bogus.
And here I was hoping nobody would notice. Do you support making it a single change to the attribute?
Single change to the attribute would be fine by me, I think; it's just a bit more painful to implement. Olli?
Single change sounds good to me.
I defined this to the extent that whenever DOMTokenList is mutated the corresponding attribute is mutated.
I still need to define the other way around, setting the attribute updating the DOMTokenList (the algorithm is already there, I just need to redo some of the infrastructure around attributes).
WebKit implements this as a single change to the attribute. I think this is important for performance reasons too.