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

typeof operator and platform objects #512

Closed
TimothyGu opened this issue Jan 18, 2018 · 6 comments
Closed

typeof operator and platform objects #512

TimothyGu opened this issue Jan 18, 2018 · 6 comments

Comments

@TimothyGu
Copy link
Member

TimothyGu commented Jan 18, 2018

The typeof operator is defined for "Object (non-standard exotic and does not implement [[Call]])" to return "Implementation-defined. Must not be "undefined", "boolean", "function", "number", "symbol", or "string"."

From

The semantics of the essential internal methods for ordinary objects and standard exotic objects are specified in clause 9.

it seems that "non-standard" means "non-ECMA-262". Then named property objects, legacy platform objects, etc. are all non-standard. We should say in Web IDL that they should all return "object"

@bzbarsky
Copy link
Collaborator

We should say in Web IDL that they should all return "object"

Sort of. HTMLAllCollection needs to return "undefined". Which the ES spec doesn't allow, of course.

@bzbarsky
Copy link
Collaborator

But yes, for the rest we should spec that they return "object"

@TimothyGu
Copy link
Member Author

Which the ES spec doesn't allow, of course.

Now it does :)

See https://tc39.github.io/ecma262/#sec-IsHTMLDDA-internal-slot-typeof and whatwg/html#3087.

@bzbarsky
Copy link
Collaborator

Now it does :)

Oh, a COMEFROM spec. Lovely. ;)

@annevk
Copy link
Member

annevk commented Feb 7, 2019

I actually think ES shouldn't say this is implementation-defined. It should be host-defined and there should be a hook for hosts to make it work more automatically. And perhaps given that document.all is fixed there need not be host exceptions?

@littledan
Copy link
Collaborator

Good point; I filed tc39/ecma262#1440 to discuss a simplification here.

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

4 participants