Skip to content

Integrate callback invocation with IDL #186

Closed

Description

@hayatoito

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

  1. rniwa commented on Mar 1, 2016

    @rniwa
    Collaborator

    Also see the issue #225.

  2. self-assigned this
    on Mar 11, 2016
  3. changed the title [-][Custom]: make callbacks more explicit (bugzilla: 24579)[/-] [+]Integrate callback invocation with IDL[/+] on Mar 29, 2016
  4. domenic commented on Apr 4, 2016

    @domenic
    Collaborator

    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:

    • Blink's [Reflect] (which I assume all other browsers have some variation of) implies their [CustomElementCallbacks].
      • I don't want to block this on specifying [Reflect] as an extended attribute.
      • I could put in a sentence where HTML defines reflection saying "this implies [CustomElementReactions] behavior" or similar. Pretty lame, but maybe the best we're going to get.
      • However, in Blink some reflected attributes are reflected manually, and still get [CustomElementCallbacks]. Assuming this is the case for other browsers too, it seems like an easy way for things to slip through the cracks and become non-interoperable.
      • I guess I could go through every single element in HTML and find all the reflected attributes and annotate them with [CustomElementReactions]? Maybe that's not so bad if this is just a prelude to later replacing it with [Reflect] variants?
    • innerText and outerText don't have a spec, but need these annotations. I guess we could put them in https://rocallahan.github.io/innerText-spec/ and hope people remember that?
    • Prefixed attributes don't have a spec (e.g. webkitdropzone).
    • XSLTProcessor doesn't have a spec (see wiki entry)
    • Aren't these supposed to fire on editing operations? The extended attribute doesn't take care of those cases, does it? How would we do it?

    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?

  5. annevk commented on Apr 5, 2016

    @annevk
    Collaborator

    Aren't these supposed to fire on editing operations? The extended attribute doesn't take care of those cases, does it? How would we do it?

    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.

  6. domenic commented on Apr 5, 2016

    @domenic
    Collaborator

    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?

    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?

    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.

    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?

  7. annevk commented on Apr 5, 2016

    @annevk
    Collaborator

    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.

  8. domenic commented on Apr 5, 2016

    @domenic
    Collaborator

    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.

  9. dglazkov commented on Apr 5, 2016

    @dglazkov
    Contributor

    FWIW, editing operations was the other reason for base element queue, I guess 😄

  10. domenic commented on Apr 5, 2016

    @domenic
    Collaborator

    Now you tell me 👿

    Seems like editing spec needs a monkeypatch too... ick.

  11. 7 remaining items

  12. esprehn commented on Apr 19, 2016

    @esprehn

    If we added [Reflect] then it could imply the delivery scope on the setter which would catch many of the random ones.

  13. added a commit that references this issue on Apr 20, 2016
  14. domenic commented on Apr 20, 2016

    @domenic
    Collaborator

    @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).

  15. sideshowbarker commented on Apr 26, 2016

    @sideshowbarker
    Contributor

    Is there any issue against the WebIDL spec for this yet?

  16. annevk commented on Apr 26, 2016

    @annevk
    Collaborator

    @sideshowbarker the current idea is to just define it in HTML directly. IDL might want to mention specifications can do that of course.

  17. added a commit that references this issue on Apr 28, 2016
  18. added a commit that references this issue on Apr 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions