-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Always enqueue an element regardless of callback #4127
Conversation
Tests: ... Fixes WICG/webcomponents#760.
not contain <var>attributeName</var>, then return.</p></li> | ||
<li><p>If <var>definition</var>'s <span | ||
data-x="concept-custom-element-definition-observed-attributes">observed attributes</span> | ||
does not contain <var>attributeName</var>, then return.</p></li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this correct? This is still an early return... An alternative would be to set a flag here to only skip the next step, which is a lil ugly, but okay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WebKit's implementation always enqueues the element regardless of which attribute is observed. But perhaps that's not as bad as connected/disconnected case since the observedAttributes
is the only thing that controls whether an attribute change is observed or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah okay, so this should not be observable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It IS observable. When mutating an attribute that's not being observed would invoke custom elements reactions at that point if the mutation was done inside a connected callback of another element, for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, right, sigh. Okay, I think in that case we should always enqueue, and add tests for both scenarios.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this would incur quite a bit of performance cost because then every DOM attribute mutation even ones that are not observed would result in the element to be inserted into a custom element reaction queue. I don't think we want to do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I was thinking that too. However, it's hard to square that with sometimes making the order of callbacks predictable and sometimes not. Shouldn't we then maintain the status quo of the standard?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with that as long as other browser vendors are okay with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with this change.
I think the performance penalty by this isn't large.
cc @rniwa |
Docs needs recorded on MDN content roadmap — https://trello.com/c/j2MktaWx/133-custom-elements-api |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as an implementation of the agreed-upon semantics. Some editorial tweaks suggested.
I'd like @rniwa to confirm that this spec matches WebKit's semantics. It's a bit hard to imagine a bug that switches from one algorithm to another that's quite different (e.g. with a new skip
variable).
So per #4127 (review) we're in a bit of a pickle. Options:
It seems 3 would require some kind of measurement to be done to make everyone comfortable it's okay. I hope everyone agrees 2 isn't worth it. |
?? I just said that I'm fine with the change as long as other browser vendors are fine. |
I see, I thought you said you were fine with maintaining the status quo. 😊 Okay, great, if everyone is onboard the main blocker here is tests. |
Hm... I'm having second thoughts about this. If we made this change, presumably, all new reaction callback we would add should do the same. But that would mean that we would enqueue a custom element into the reaction queue at timings we currently don't do. That seems like a serious forward compatibility issue to me. |
Supersedes and closes #4127. Closes WICG/webcomponents#760.
Supersedes and closes #4127. Closes WICG/webcomponents#760.
Supersedes and closes #4127. Closes WICG/webcomponents#760.
Supersedes and closes whatwg#4127. Closes WICG/webcomponents#760.
Supersedes and closes whatwg#4127. Closes WICG/webcomponents#760.
Supersedes and closes whatwg#4127. Closes WICG/webcomponents#760.
Tests: ...
Fixes WICG/webcomponents#760.
/acknowledgements.html ( diff )
/custom-elements.html ( diff )