Different scopes have different execution environments. This means that they have different built-ins
(different global object, different constructors, etc.). This may result in unexpected results. For instance,
[] instanceof window.frames[0].Array will return false, because Array.prototype !== window.frames[0].Array
and arrays inherit from the former.
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof
Note: just add another check if the current event.type checking is insufficient.
Different scopes have different execution environments. This means that they have different built-ins (different global object, different constructors, etc.). This may result in unexpected results. For instance,
[] instanceof window.frames[0].Array
will returnfalse
, becauseArray.prototype !== window.frames[0].Array
and arrays inherit from the former. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceofNote: just add another check if the current
event.type
checking is insufficient.