rtfeldman / seamless-immutable

Immutable data structures for JavaScript which are backwards-compatible with normal JS Arrays and Objects.
BSD 3-Clause "New" or "Revised" License
5.37k stars 195 forks source link

instanceof checks can cause issues #61

Closed WickyNilliams closed 8 years ago

WickyNilliams commented 8 years ago

Using instanceof to check for arrays etc. can cause issues across frame boundaries. Each document has a different context so one array may not be an instanceof another.

var frame = document.createElement("iframe");

frame.onload = function(e) {
  console.log([] instanceof frame.contentWindow.Array); // false
}

document.body.appendChild(frame);
rtfeldman commented 8 years ago

Hm, I don't quite follow the case where this could cause a problem for seamless-immutable.

Could you show a code example where this would lead seamless-immutable to behave undesirably?