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

Definition of "is an array index" makes "-0" an array index #516

Closed
foolip opened this issue Jan 31, 2018 · 4 comments
Closed

Definition of "is an array index" makes "-0" an array index #516

foolip opened this issue Jan 31, 2018 · 4 comments

Comments

@foolip
Copy link
Member

foolip commented Jan 31, 2018

https://heycam.github.io/webidl/#dfn-array-index-property-name

This links to https://tc39.github.io/ecma262/#sec-canonicalnumericindexstring which special-cases "-0".

This problem was introduced with #427, the previous definition was OK:
https://web.archive.org/web/20170903233050/heycam.github.io/webidl/#dfn-array-index-property-name

If the current definition were used, it would mean that document.all["-0"] should behave like document.all["0"], which it doesn't as implemented.

@foolip
Copy link
Member Author

foolip commented Jan 31, 2018

@TimothyGu can you take a look?

@TimothyGu
Copy link
Member

I'm inclined to just say "If P is an array index" as ES does it, but since that's not preferred here just adding a "-0" as an early return is fine.

@annevk
Copy link
Member

annevk commented Jan 31, 2018

Well, this affects more than just document.all, right? I think we very much want the Ecma array index definition for other indexed getters...

@foolip
Copy link
Member Author

foolip commented Jan 31, 2018

Yes, it affects more things, and I don't think @TimothyGu was suggested a document.all-specific workaround.

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

3 participants