You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first case works fine, no questions about it, no matter whether via a button or via the reset() API, it works well and the formResetCallback hook makes itself known.
The second case fails, it does not call the formResetCallback hook (detailed below).
The third case also does not execute the formResetCallback hook, the conditions for its execution are unachievable (due with form-associated custom elements).
<script>customElements.define("my-input",classextendsHTMLElement{staticformAssociated=true;connectedCallback(){console.log("my-input connected");}formResetCallback(){console.log("my-input performed formResetCallback");}});</script><form><my-input></my-input></form>
And if you run such html file with a custom element that has the reset algorithm:
Then we will not see the called formResetCallback hook, but this should work (yes, we are talking about the second case, when the HTML parser creates an element for the token and after run reset algorithm in step 13).
I checked this in the latest Chrome and Firefox, the hook is not called. What's wrong?
Maybe problem is in this note, why implementations don't correspond the step 13:
A custom element possesses the ability to respond to certain occurrences by running author code:
Thanks for the investigation! I agree this is strange; I can't get the formResetCallback in your example to run in any browser despite the spec which seems to call for its invocation during construction. I'm wondering if this is really just a bug in all implementations or if there is a subtle part of the spec that excludes the callback from being run in this case. @mfreed7, any chance you know?
I'm wondering if this is really just a bug in all implementations or if there is a subtle part of the spec that excludes the callback from being run in this case. @mfreed7, any chance you know?
Interesting - I can confirm. That does sound like a correct reading of the spec, but it doesn't seem to be implemented. Unfortunately, I don't know the history here, so I don't know if that's a spec accident or a browser accident. I'm also wondering if it would be web compatible to just start calling formResetCallback every time we parse a FACE? Feels like potentially no?
What is the issue with the HTML Standard?
There are 3 places in the specification where the reset algorithm is triggered:
The reset algorithm, which resets the state of all form participants to default values
The create an element for a token algorithm, whose task is to create an element for the HTML parser.
The reactivate algorithm, which is used to update the document
The first case works fine, no questions about it, no matter whether via a button or via the reset() API, it works well and the
formResetCallback
hook makes itself known.The second case fails, it does not call the
formResetCallback
hook (detailed below).The third case also does not execute the
formResetCallback
hook, the conditions for its execution are unachievable (due with form-associated custom elements).As a small test, I made this example for the create an element for a token case:
And if you run such html file with a custom element that has the reset algorithm:
Then we will not see the called
formResetCallback
hook, but this should work (yes, we are talking about the second case, when the HTML parser creates an element for the token and after run reset algorithm in step 13).I checked this in the latest Chrome and Firefox, the hook is not called. What's wrong?
Maybe problem is in this note, why implementations don't correspond the step 13:
By the way, that wpt test is too old, it does not check what I am talking about.
What do you say editors?
The text was updated successfully, but these errors were encountered: