Skip to content
This repository was archived by the owner on Mar 19, 2018. It is now read-only.
This repository was archived by the owner on Mar 19, 2018. It is now read-only.

Better feature detection: getSupportedListenerOptions is weird #16

Closed

Description

@smaug----

There are plenty of APIs taking a dictionary as a param, yet I don't recall anything like getSupportedListenerOptions(). Do we really need it?

Activity

  1. RByers commented on Jul 8, 2015

    @RByers
    Member

    Yeah I wasn't sure how best to handle feature detection (#8). If we go with your idea of a backwards-compatible hint (eg. #12) then perhaps we can get away without feature detection so maybe we need to resolve the debate in #2 before worrying about this.

    But even if we go with a backwards compatible "hint", might there still not be scenarios where a library wants to know whether the hint is supported? Eg. maybe if it knows performance will be improved it'll disable some minor feature in order to be able to take advantage of non-cancelable touch events. But maybe that's too minor of a reason to justify.

  2. smaug---- commented on Jul 8, 2015

    @smaug----
    CollaboratorAuthor

    I think before exposing getSupportedListenerOptions() to the platform this needs some more generic discussion whether we want to expose possible dictionary properties and their default values - not only in this API but in APIs in general.

  3. RByers commented on Jul 8, 2015

    @RByers
    Member

    Sounds like a good idea. Let's try to resolve the debate in #2 first. Then if we still need some form of feature detection I can start this discussion. What do you think is the appropriate forum?

  4. RByers commented on Jul 9, 2015

    @RByers
    Member

    @foolip suggests (on whatwg list) putting getSupportedListenerOptions this on EventTarget instead of Event.

  5. bzbarsky commented on Jul 9, 2015

    @bzbarsky
    Collaborator

    For just feature detection, you can use an object with getters on it. That won't tell you the default values of the dictionary properties; just which dictionary properties are supported by the browser.

  6. RByers commented on Jul 9, 2015

    @RByers
    Member

    Oooh, cool - thank you! I'm sold.

  7. changed the title [-]getSupportedListenerOptions is something very unique in the platform[/-] [+]Better feature detection: getSupportedListenerOptions is weird[/+] on Jul 9, 2015
  8. dtapuska commented on Jul 9, 2015

    @dtapuska
    Collaborator

    @bzbarsky Doesn't this rely on the implementation detail that they will be queried when addEventListener executes. Some implementations might wait until a property is queried or dispatchEvent to execute no? (I'm not sure on the details of the other implementations)

  9. bzbarsky commented on Jul 9, 2015

    @bzbarsky
    Collaborator

    @dtapuska The dictionary properties must be queried before the spec algorithm of addEventListener executes. That's not an implementation detail; it's a basic Web IDL spec requirement. The timing is fully specified, the order in which the getters are executed is fully specified. Has to be that way, since getters can have arbitrary side-effects so you have to pin down the behavior completely to get anything resembling interop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions