Closed ajklein closed 5 years ago
Great catch! @michaelficarra, WDYT?
I'm fine either way. We could just add them for consistency, or we could also keep them out until/unless we find they are needed.
I'm leaning towards adding them for consistency and "just in case".
V8 patch: https://chromium-review.googlesource.com/c/v8/v8/+/1390125
Looking at this more closely, the text below the Array.prototype[@@unscopables]
section in the spec makes it clear that the intention is to prevent issues, rather than fix only the cases that are known to break the web. Note the use of the word "might".
Array methods added in ES2015 and ES2016 were added to the
@@unscopables
object attached to Array.prototype, to avoid a set of web-compat worries. Shouldflat
andflatMap
be added as well? Or was that considered and rejected for some reason?Note that I'm not aware of any breakage due to them being left off, I just noticed this inconsistency while cleaning up some code.
@mathiasbynens