Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should callback interface objects have a "length" property? #279

Closed
tobie opened this issue Jan 23, 2017 · 6 comments
Closed

Should callback interface objects have a "length" property? #279

tobie opened this issue Jan 23, 2017 · 6 comments

Comments

@tobie
Copy link
Collaborator

tobie commented Jan 23, 2017

Callback interface objects already have a "name" property (when exposed due to the presence of constants) . The omission of a "length" prop (with value 0) in the spec seems more accidental than deliberate. Chrome, Safari and Firefox all implement it, e.g.:

NodeFilter.length;
// => 0
@tobie tobie changed the title Should callback interface objects have a "length" property Should callback interface objects have a "length" property? Jan 23, 2017
@tobie
Copy link
Collaborator Author

tobie commented Jan 23, 2017

idlharness excludes callback interfaces (with constants) from testing for the presence and value of length.

@domenic
Copy link
Member

domenic commented Jan 23, 2017

Edge also supports this.

@domenic
Copy link
Member

domenic commented Jan 23, 2017

A more interesting question is whether it should be an own property. NodeFilter.hasOwnProperty("length") returns true in Gecko and Blink but not Edge. (In Edge, it gets the length from NodeFilter.__proto__ === Function.prototype.)

@domenic
Copy link
Member

domenic commented Jan 23, 2017

So I guess this amounts to changing

Interface objects for non-callback interfaces

to

All interface objects

and adding tests I suppose

@tobie
Copy link
Collaborator Author

tobie commented Jan 23, 2017

A more interesting question is whether it should be an own property. NodeFilter.hasOwnProperty("length") returns true in Gecko and Blink but not Edge. (In Edge, it gets the length from NodeFilter.proto === Function.prototype.)

For consistency with other interface objects, own prop seems more judicious.

@tobie
Copy link
Collaborator Author

tobie commented Jan 24, 2017

See also whatwg/dom#186 and #83.

tobie added a commit to tobie/webidl that referenced this issue Jan 24, 2017
* Extract legacy callback interface objects
  out of interface objects. Closes whatwg#78.
* Clarify that legacy callback interfaces are function objects.
* Give them a length property. Closes whatwg#279. Closes whatwg#83.
* Require new for Named Constructors. Closes whatwg#275.
* Rely on ES abstract operations for defining,
  named constructors, interface objects, and
  legacy callback interface objects.
* Disallow using the [NoInterfaceObject] on
  callback interfaces with constants.
tobie added a commit to tobie/webidl that referenced this issue Jan 24, 2017
* Extract legacy callback interface objects
  out of interface objects. Closes whatwg#78.
* Clarify that legacy callback interfaces are function objects.
* Give them a length property. Closes whatwg#279. Closes whatwg#83.
* Require new for Named Constructors. Closes whatwg#275.
* Rely on ES abstract operations for defining,
  named constructors, interface objects, and
  legacy callback interface objects.
* Disallow using the [NoInterfaceObject] on
  callback interfaces with constants.
tobie added a commit to tobie/webidl that referenced this issue Feb 14, 2017
* Extract legacy callback interface objects
  out of interface objects. Closes whatwg#78.
* Clarify that legacy callback interfaces are function objects.
* Give them a length property. Closes whatwg#279. Closes whatwg#83.
* Require new for Named Constructors. Closes whatwg#275.
* Rely on ES abstract operations for defining,
  named constructors, interface objects, and
  legacy callback interface objects.
* Disallow using the [NoInterfaceObject] on
  callback interfaces with constants.
tobie added a commit to tobie/webidl that referenced this issue Feb 20, 2017
* Extract legacy callback interface objects
  out of interface objects. Closes whatwg#78.
* Clarify that legacy callback interfaces are function objects.
* Give them a length property. Closes whatwg#279. Closes whatwg#83.
* Require new for Named Constructors. Closes whatwg#275.
* Rely on ES abstract operations for defining,
  named constructors, interface objects, and
  legacy callback interface objects.
* Disallow using the [NoInterfaceObject] on
  callback interfaces with constants.
tobie added a commit to tobie/webidl that referenced this issue Feb 20, 2017
* Extract legacy callback interface objects
  out of interface objects. Closes whatwg#78.
* Clarify that legacy callback interfaces are function objects.
* Give them a length property. Closes whatwg#279. Closes whatwg#83.
* Require new for Named Constructors. Closes whatwg#275.
* Rely on ES abstract operations for defining,
  named constructors, interface objects, and
  legacy callback interface objects.
* Disallow using the [NoInterfaceObject] on
  callback interfaces with constants.
tobie added a commit that referenced this issue Feb 20, 2017
* Extract legacy callback interface objects
  out of interface objects. Closes #78.
* Clarify that legacy callback interfaces are function objects.
* Give them a length property. Closes #279. Closes #83.
* Require new for Named Constructors. Closes #275.
* Rely on ES abstract operations for defining
  named constructors, interface objects, and
  legacy callback interface objects.
* Disallow using [NoInterfaceObject] on
  callback interfaces with constants.
* Don't require an interface prototype object for constants.
  Callback interfaces do not have an interface prototype object.
  Their constants sit on the legacy callback interface object itself.
  Closes #281.

Closes #283.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants