Repository navigation
Description
Title: [Custom]: make callbacks more explicit (bugzilla: 24579)
Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24579
comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24579#c0
Anne wrote on 2014-02-07 11:00:05 +0000.
"Any time a script calls a method, reads or sets a property that is implemented by the user agent, the following actions must occur: "
This needs to become part of the actual algorithms such as innerHTML, cloneNode(), etc. The easiest way to do that is tying it to IDL I think just as is done in the Chrome implementation.
I recommend working with heycam on doing that per my outline in http://lists.w3.org/Archives/Public/public-webapps/2014JanMar/0142.html as that makes it much more explicit when everything happens relative to each other.
comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24579#c1
Anne wrote on 2014-02-07 11:01:53 +0000.
Note that we also need this mechanism for callbacks implemented by the user agent. E.g. when adoption happens we want to queue a callback that runs before the method that caused the adoption to return and mangles prototypes.
comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24579#c2
Dimitri Glazkov wrote on 2014-05-09 20:32:46 +0000.
I was just reading up on extended attributes: http://heycam.github.io/webidl/#idl-extended-attributes.
A simple ExtendedAttributeNoArgs thingy should suffice in this case -- something like [InvokesCustomElementCallbacks] or [ProcessesCustomElementCallbacks] or [ElementCallbackBarrier]?
Heycam, should I just write this down in custom elements spec, or should it be part of Web IDL spec, like ES-specific attributes: http://heycam.github.io/webidl/#es-extended-attributes?
comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24579#c3
Dimitri Glazkov wrote on 2014-10-27 17:34:02 +0000.
*** Bug 27179 has been marked as a duplicate of this bug. ***
comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24579#c4
Anne wrote on 2014-10-27 17:42:42 +0000.
(Currently Web IDL offers no way for other specifications to define extended attributes.)
Activity
rniwa commentedon Mar 1, 2016
Also see the issue #225.
[-][Custom]: make callbacks more explicit (bugzilla: 24579)[/-][+]Integrate callback invocation with IDL[/+]domenic commentedon Apr 4, 2016
So, I started on this in a branch: https://rawgit.com/w3c/webcomponents/ce-reactions-idl/spec/custom/index.html#web-idl-customelementreactions (the list of integrations is rather incomplete)
Please read the "NOTE" about why we're doing this to make sure I haven't misinterpreted.
Here are some problems I foresee, after spending about an hour going through all of Blink's annotations:
I kind of want to give up and go back to the "every attribute and every property do this; optimize away unnecessary cases" idea. Are we sure that explicitly annotating everything is the right move?
annevk commentedon Apr 5, 2016
Presumably these operations are (will be, more likely, if ever) defined as running these as part of some kind of task. So perhaps the microtask checkpoint also needs to run element callbacks if they haven't been run yet?
As for the rest, IDL needs to be changed to account for this. Whether we enumerate the places for which it matters or leave that up to implementations is less important, but it seems that if everyone needs to do that work anyway, it might help if we did it for everyone.
domenic commentedon Apr 5, 2016
It's not that simple. You need to push an element queue on when the operation starts, and pop it when it stops. I guess we could push one on at the start of every task, and pop at the end? @dglazkov, @esprehn, do you know how Blink handles this with regard to editing operations?
Why, and how, would we change IDL if we don't enumerate the places that need the extended attribute? Do you have thoughts about how to handle reflection, and how to handle the things that don't have a spec?
annevk commentedon Apr 5, 2016
We'd just do it for everything (which will result in a no-op mostly, since no callbacks will have been queued). Changing IDL makes it much more clear where in the flow of code this happens, which will be in IDL in all implementations.
Things that don't have a spec will need to be defined, since it's unclear how they work anyway, with or without this feature.
domenic commentedon Apr 5, 2016
Ah, I see, so you're saying change the definition of IDL attributes and operations to include these before/after steps in all of them, instead of having the monkeypatch be in HTML. OK, that's certainly doable and reasonable.
I'm going to tag this "needs consensus" since if we have time I'd like to discuss it on the telecon today. It seems largely a question of what implementers would prefer, since from a spec side, doing it everywhere is equivalent to annotating everything individually.
We'll need to solve the editing operations issues separately of course.
dglazkov commentedon Apr 5, 2016
FWIW, editing operations was the other reason for base element queue, I guess 😄
domenic commentedon Apr 5, 2016
Now you tell me 👿
Seems like editing spec needs a monkeypatch too... ick.
7 remaining items
esprehn commentedon Apr 19, 2016
If we added
[Reflect]then it could imply the delivery scope on the setter which would catch many of the random ones.Formalize custom element reactions
Formalize custom element reactions
Formalize custom element reactions
Formalize custom element reactions
domenic commentedon Apr 20, 2016
@esprehn yeah, I plan to add [Reflect] later, which will in many cases supercede the need for [CEReactions]. But I didn't want to block this work on figuring out [Reflect] (which is fairly complicated).
Add [CEReactions] annotations to mutating methods
Add [CEReactions] annotations to mutating methods
sideshowbarker commentedon Apr 26, 2016
Is there any issue against the WebIDL spec for this yet?
annevk commentedon Apr 26, 2016
@sideshowbarker the current idea is to just define it in HTML directly. IDL might want to mention specifications can do that of course.
sync upstream (#1)
Add [CEReactions] annotation to as
Take care of missing custom element reactions
Take care of missing custom element reactions