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 iterator prototype object next functions be enumerable? #739

Open
domenic opened this issue Jun 24, 2019 · 2 comments
Open

Should iterator prototype object next functions be enumerable? #739

domenic opened this issue Jun 24, 2019 · 2 comments

Comments

@domenic
Copy link
Member

domenic commented Jun 24, 2019

https://heycam.github.io/webidl/#es-iterator-prototype-object (and the corresponding part of #720) says they are. Their ECMAScript counterparts are not.

Unlike #738, here I lean toward making them non-enumerable, as these objects are in some sense "entirely ECMAScript-like". The method in question doesn't share a location with enumerable methods corresponding to Web IDL operations.

But, I don't care that much. If we want to keep these enumerable, we should at least add a note about the intentional divergence from ECMAScript.

@bzbarsky
Copy link
Collaborator

I don't have strong opinions on this either, apart from possible implementation difficulty (e.g. Gecko currently synthesizes non-exposed IDL interfaces for the iterator, and we don't have an obvious way to make stuff there non-enumerable, iirc).

Currently

<script>
  var i = (new URLSearchParams())[Symbol.iterator]();
  document.write(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(i), "next").enumerable);
</script>

shows true in all browsers, fwiw.

@bzbarsky
Copy link
Collaborator

Ah, I guess Gecko has a [NonEnumerable] thing we added for maplike/setlike things, so implementing whatever we want would not be hard 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

2 participants