I believe the latest jQuery source has dropped support for a lot of legacy
browsers. Regardless, even release 1.6.1 uses the implementation.

On Fri, Apr 27, 2012 at 11:17 AM, Filip Maj <[email protected]> wrote:

> For reference: https://issues.apache.org/jira/browse/CB-588
>
> Essentially: using instanceof across windows (basically: iframes) is bad.
> Daniel from the issue thread above posted a link [1] explaining the
> underlying issue in a bit more detail.
>
> In this specific example, GWT apps use an iframe to create initialization
> callbacks and whatnot. Attaching these callbacks to deviceready (or other
> cordova events) in the parent window doesn't work because instanceof
> doesn't work across frames.
>
> The link [1] offers a workaround: calling toString() on whatever you want
> to check the instance of and comparing it against "[object
> myPrototypeName]". My initial thought is, that seems weak, but taking a
> look at jQuery source (see [2] and [3] together), they use this same
> approach. That tells me it's pretty battle hardened.
>
> I'm leaning towards employing the toString() approach instead of a
> combination of typeof and duck-typing to fix this issue.
>
> I wanted to run it by the list to make sure this sounds alright and see if
> anyone has any problems with this.
>
> Cheers,
> Fil
>
> [1]
> http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-
> robust-isarray/
> [2] https://github.com/jquery/jquery/blob/master/src/core.js#L471-L491
> [3] https://github.com/jquery/jquery/blob/master/src/core.js#L900-L902
>
>

Reply via email to