-
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
Fix custom element state setting for new CustomElement() #1309
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
domenic
added
the
topic: custom elements
Relates to custom elements (as defined in DOM and HTML)
label
May 24, 2016
domenic
added a commit
to whatwg/dom
that referenced
this pull request
May 24, 2016
As of whatwg/html#1309, this is no longer necessary, as it is taken care of in the Construct(C) step.
LGTM |
As discussed in #1297, the spec previously did not correctly set custom element state to "custom" for the case of new CustomElement(). The correct place to do this is in the HTMLElement constructor (invoked by the super() call), since that is the last place user agent code is invoked, and so our last chance to change the state. In practice, this affects the behavior of the :defined pseudo-class. Fixes #1297. Also fixes a typo in the same algorithms, where the variable names "element" and "interface" were accidentally both used.
domenic
added a commit
to whatwg/dom
that referenced
this pull request
May 31, 2016
As of whatwg/html#1309, this is no longer necessary, as it is taken care of in the Construct(C) step.
annevk
pushed a commit
to whatwg/dom
that referenced
this pull request
Jun 1, 2016
As of whatwg/html#1309, this is no longer necessary, as it is taken care of in the Construct(C) step.
annevk
pushed a commit
to whatwg/dom
that referenced
this pull request
Jun 1, 2016
As of whatwg/html#1309, this is no longer necessary, as it is taken care of in the Construct(C) step.
domenic
added a commit
that referenced
this pull request
Jun 1, 2016
As pointed out in #1297 (comment), the setup introduced in #1309 allows custom element reactions to happen during custom element constructors. This is unavoidable, but the spec did not account for its consequences, leading to cases where a custom element reaction would be called twice for the same attribute (or the same element being connected). By moving these steps to the top of the algorithm, we ensure that reactions are only enqueued for the state of the world before the constructor runs, and that any reactions caused by actions inside the constructor are then taken care of by the usual mechanisms. Closes #1297 again.
annevk
pushed a commit
that referenced
this pull request
Jun 6, 2016
As pointed out in #1297 (comment), the setup introduced in #1309 allows custom element reactions to happen during custom element constructors. This is unavoidable, but the spec did not account for its consequences, leading to cases where a custom element reaction would be called twice for the same attribute (or the same element being connected). By moving these steps to the top of the algorithm, we ensure that reactions are only enqueued for the state of the world before the constructor runs, and that any reactions caused by actions inside the constructor are then taken care of by the usual mechanisms. Closes #1297 again.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As discussed in #1297, the spec previously did not correctly set custom
element state to "custom" for the case of new CustomElement(). The
correct place to do this is in the HTMLElement constructor (invoked by
the super() call), since that is the last place user agent code is
invoked, and so our last chance to change the state. In practice, this
affects the behavior of the :defined pseudo-class.
Fixes #1297. Also fixes a typo in the same algorithms, where the
variable names "element" and "interface" were accidentally both used.
/cc @dominiccooney @kojiishi