-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOMSettableTokenList needs an associated content attribute #81
Comments
Also see HTMLOutputElement.htmlFor [2]: When setting htmlFor, you would definitely expect the 'for' attribute to be updated as well. However, the DOM specification for DOMSettableTokenList.value [3] setter does not say anything about it. It only says to update the tokens, it does not say we should run the update steps [4]. I have verified in Firefox that setting HTMLOutputElement.htmlFor to a given string does update the associated 'for' attribute. [2] https://html.spec.whatwg.org/#htmloutputelement |
Have you any test case? This behavior often depends on the particular browser. Some time ago I test DOMSettableTokenList for HTMLLinkElement.sizes but noticed different behaviour in Firefox, Chrome and IE11:
Chrome: link.sizes: 32x32 48x48 48x48 link.sizes: 48x48 Firefox: link.sizes: 32x32 48x48 48x48 link.sizes: 48x48 IE11: link.sizes: 32x32 48x48 48x48 link.sizes: 32x32 48x48 48x48 I'm not sure what behaviour is correct, changing attr's value via attr.value should change sets (from DOMSettableTokenList) or not? If yes where exactly do I find this definition? In DOM I see just this: |
@ArkadiuszMichalski: You are talking about the opposite case (i.e. Should updating the content attribute also update the associated DOM(Settable)TokenList token?). For the record, I would also like for this case to be clarified but this is not what this bug is about. This bug is about updating the associated content attribute when the DOMSettableTokenList tokens are updated. The DOM spec is clear about the fact that it should happen for DOMTokenList but says that DOMSettableTokenList does not have an associated content attribute. I think this difference in behavior is odd, especially considering DOMSettableTokenList is used in the HTML spec for attributes that reflect content attributes. |
@cdumez: I presented both case in this example for DOMSettableTokenList: changing set of tokens > affect content attribute (Firefox, not Chrome and not IE^) and wondering if the same happen for other cases (not only HTMLLinkElement.sizes). And I see that DOM is precise here (even for DOMTokenList and class, where we have in prose what should be done when changing attr value, the opposite situation is described in sets algo) but HTML is very economical and to general for both of these interface : Of course it would be useful to know why DOMSettableTokenList should not affect the content attribute and vice versa (when we are modifying one of them), compatibility reason? |
Looking at the history of this API in HTML I think DOM is simply wrong here. Not sure how that happened. As for the other question, setting Paging @bzbarsky and @domenic to make sure I'm not missing anything. |
Ah, if you pain attention to clean up sets, then this bug should be somehow fixed too: |
Yeah, I think DOM is just wrong here. And yes, setting |
@bzbarsky: yes, but not in Chrome (question is why, maybe spec bug). DOMSettableTokenList should not just work as DOMTokenList + one additional argument (value)? |
@ArkadiuszMichalski I'm not sure what you're asking. The whole point of As far as Chrome's implementation goes, it does the following for places where the HTML spec uses
So my take on it is that Chrome has correct implementations of this for various places (e.g. sandbox/ping), has two broken ones (HTMLOutputElement.htmlFor |
@bzbarsky: Some times ago I tested only HTMLLinkElement.sizes in Chrome (because Firefox not support this yet) and see that setting new value don't actual content attribute (what per spec was correct because DOMSettableTokenList has not associated any content attribute). Now your explanation is sufficiently detailed and I do not have any more questions, just waiting for fixing. |
TODO:
|
@bzbarsky: have another question, you wrote "HTMLTableCellElement.headers -- implemented as a string, not a DOMSettableTokenList" << but this string type is correct or not? I ask because test ping variant in Chrome and Firefox (HTMLAnchorElement, HTMLAnchorElement) and they both return string (not DOMSettableTokenList object), but you wrote that "So my take on it is that Chrome has correct implementations of this for various places (e.g. sandbox/ping)". Per IDL [PutForwards=value] should not only affect setting, not getting? And Anne today make changes for DOMSettableTokenList: |
Define "correct"? The HTML spec says
I assume you meant ( In Chrome dev (48.something),
It should act exactly the way setAttribute acts, I would think. |
Or perhaps |
I mean correct per actual specs (HTML/DOM/Web IDL and other) what I suppose all browsers should go (or try) if that DOMSettableTokenList and [PutForwards=value] appear on this documents and no one protested. Ohh, I check only stable Chrome 46 so this is the reason for my surprise, now downolading canary and devs and testing what is happening here. In Chrome 48 dev:
|
@cdumez is "Christophe Dumez" in the acknowledgments still your preferred spelling? Or is that somebody else? |
@annevk Thanks for asking. I am "Christophe Dumez" (and already in the acknowledgments) but I go by "Chris Dumez" these days. If you could update it, it would be great, thanks. |
You got it. |
https://dom.spec.whatwg.org/#interface-domsettabletokenlist
The HTML specification is using the DOMSettableTokenList in places where there is an associated attribute. For e.g. HTMLAnchorElement.ping [1]:
[PutForwards=value] readonly attribute DOMSettableTokenList ping;
It needs to be a DOMSettableTokenList because PutForwards needs to be able to set the 'value' attribute on the DOMSettableTokenList.
[1] https://html.spec.whatwg.org/multipage/semantics.html#the-a-element
The text was updated successfully, but these errors were encountered: