Bug 20105 - Nothing in the spec really defines how changes to token lists change the underlying string
Nothing in the spec really defines how changes to token lists change the unde...
Status: RESOLVED FIXED
Product: WebAppsWG
Classification: Unclassified
Component: DOM
unspecified
PC Windows 3.1
: P2 normal
: ---
Assigned To: Anne
public-webapps-bugzilla
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-11-27 18:56 UTC by Boris Zbarsky
Modified: 2012-12-07 13:17 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Boris Zbarsky 2012-11-27 18:56:53 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.
Comment 1 Anne 2012-11-27 19:12:52 UTC
And here I was hoping nobody would notice. Do you support making it a single change to the attribute?
Comment 2 Boris Zbarsky 2012-11-27 19:30:49 UTC
Single change to the attribute would be fine by me, I think; it's just a bit more painful to implement.  Olli?
Comment 3 Olli Pettay 2012-11-27 19:43:46 UTC
Single change sounds good to me.
Comment 4 Anne 2012-12-04 15:57:02 UTC
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).
Comment 5 Erik Arvidsson 2012-12-04 15:58:11 UTC
WebKit implements this as a single change to the attribute. I think this is important for performance reasons too.