Open jdalton opened 9 years ago
Is there any way to test this without an iframe (in node)? The spec specifies "exotic Array object" only - is an Array from another iframe exotic?
Realms are a red herring. Subclasses are the more interesting case where consulting this.constructor matters.
Is there any way to test this without an iframe (in node)?
Yap, you can use require('vm')
.
There's the perf side to consider; wrapping all those methods would be hella bad for that. Maybe this is one that es6-shim opts out of and just documents the lack of support.
Indeed, that's one of my main concerns. At the least, we can ensure that our actual shims do the right thing, even if we choose not to detect and override every existing Array method :-)
Array.prototype.map.call(document.querySelectorAll("*"), function (e) {
return e.tagName;
});
am i right, that this code should throw error (because NodeList is not constructable) according to spec?
@Yaffle yes, I believe so.
seems, this was discussed here:
https://esdiscuss.org/topic/array-prototype-slice-web-compat-issue#content-17
OK, i am not using Array.prototype.map
for NodeList
s anyway, so I am fine with it.
Wow, that's a shame, that's a really common existing pattern.
For example see step 9 of this https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.filter