Skip to content

Should probably spec a hasInstance for DOM interface objects #129

Closed
@bzbarsky

Description

@bzbarsky

Right now we have a [[HasInstance]] thing at http://heycam.github.io/webidl/#es-interface-hasinstance but that's gone in ES6.

Proposed prose with similar semantics is something like:

  1. Let F be the this value.
  2. Let V be the first argument we were passed.
  3. If F is not an object, return false.
  4. If F is not an interface object, return false (or delegate to OrdinaryHasInstance?)
  5. If V is not an object, return false.
  6. If V is an object that implements the interface for which F is the interface object (defined in terms of brands, whatever), return true.
  7. Return OrdinaryHasInstance(F, V).

@domenic, thoughts?

An open question is whether Node[Symbol.hasInstance] == Element[Symbol.hasInstance] should test true or false. We could go either way, given the above prose, since they would implement the same algorithm...

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