-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Clarification on Element reflected IDL attribute steps #10150
Comments
Hmm, so I think this was an oversight on my side when reviewing the patch that introduced the test. So the setter's step 2 is:
So However, per spec, https://dom.spec.whatwg.org/#concept-element-attributes-set-value does run the attribute change steps, even if the attribute didn't change. Apparently this is consistent with mutation events too. So I think this is a Firefox bug, and we also need to clear the explicit element even if the attribute doesn't change... Unless someone disagrees? I find it quite weird that |
cc @smaug---- in case you have opinions. |
https://bugzilla.mozilla.org/show_bug.cgi?id=1881075 has a fix for that. |
Thanks!
So the spec as written would clear the explicitly set attr element every time you set it? |
Yeah, unless I'm misreading. |
Setting an attribute value means setting an attribute value - doesn't matter whether the value is the same or not :) |
See whatwg/html#10150. Per spec these run even if the attribute doesn't change. Differential Revision: https://phabricator.services.mozilla.com/D202240 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1881075 gecko-commit: 2c4646b33c7313f86fb6fb60be42fb5fcb5f106b gecko-reviewers: zsun
See whatwg/html#10150. Per spec these run even if the attribute doesn't change. Differential Revision: https://phabricator.services.mozilla.com/D202240
See whatwg/html#10150. Per spec these run even if the attribute doesn't change. Differential Revision: https://phabricator.services.mozilla.com/D202240 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1881075 gecko-commit: 2c4646b33c7313f86fb6fb60be42fb5fcb5f106b gecko-reviewers: zsun
Can this be closed? |
Yeah... We might want a different name for the attribute change steps (maybe attribute set or remove steps? Though that's a mouthful) |
We could use "mutation" to align with mutation observers (or poke/meddle), but fundamentally you have to know these steps always run. If you want to make a change (hah) like that, prolly best discussed over in whatwg/dom. |
See whatwg/html#10150. Per spec these run even if the attribute doesn't change. Differential Revision: https://phabricator.services.mozilla.com/D202240 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1881075 gecko-commit: 2c4646b33c7313f86fb6fb60be42fb5fcb5f106b gecko-reviewers: zsun
See whatwg/html#10150. Per spec these run even if the attribute doesn't change. Differential Revision: https://phabricator.services.mozilla.com/D202240
What is the issue with the HTML Standard?
https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#reflecting-content-attributes-in-idl-attributes%3Aelement
Consider the following:
The latest implementation in chromium returns null for popoverTargetElement, and firefox returns the popover element. The reason that chromium returns null is because of these steps in the spec (which is implemented here):
When the attribute is set to the empty string, then it sets the explicitly set attr element to null. A WPT change was made here which tests this: web-platform-tests/wpt#44634
@ziransun @emilio which behavior is correct?
The text was updated successfully, but these errors were encountered: