On Aug 19, 11:04 pm, ak732 <ask...@gmail.com> wrote:
>         ofn.apply(this, arguments);

Be aware that the "arguments" object is-not-a Array (it's an object
with a length property), and i don't think there's a guaranty that
that apply() will handle that special case. Also be aware that apply
takes a list of args, like foo.apply(this,arg1,arg2,arg3), whereas call
() takes the args as a single array: foo.call(this,[arg1,arg2,arg3]).
i suspect that's what you actually want here.

The normal workaround for converting 'arguments' to an array looks
something like:

    var av = Array.prototype.slice.apply(arguments,[0]);
    myfunc.apply( this, av );


> sense?  It could do what it does for other areas of Javascript which
> is mitigate the browser differences.  To be complete, it would need to
> employ onerror, add a try-catch block to document.ready(), and do
> something similar to the above for event handlers (only in mozilla).
>
> Thoughts?  Is this just stupid?

While i agree with the last bit that it might help improve the overall
quality of jQuery client apps, my suspicions are that:

a) Many people will bitch and moan about a perceived performance
penalty for using try/catch (i know C++ people often bitch about it).

b) Your solution seems like such an easy thing to do, that the jQuery
devs would be justified in saying, "just do what you just
demonstrated." That said, having a public jQuery API which swaps
out .bind() with an impl like yours might be a good idea.

In any case, i will certainly give this a try in a jQuery-based
application framework i'm working on.

:)

Reply via email to