dequal icon indicating copy to clipboard operation
dequal copied to clipboard

Fails to correctly compare objects created by constructors from another realm (like iframes)

Open NickGard opened this issue 5 years ago • 4 comments

This is definitely an edge-case, but when comparing objects like Array across iframe boundaries, instanceof will not work. See MDN's example of this: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray#instanceof_vs_isArray

NickGard avatar Jul 20 '20 20:07 NickGard

Thanks, TIL but that makes sense 👍

lukeed avatar Jul 20 '20 21:07 lukeed

This can be fixed by avoiding instanceof or .constructor, and relying on native brand-checking mechanisms.

ljharb avatar Jun 07 '23 20:06 ljharb