Meta Plugin possible bug:

The meta plugin appears to assume that the old $().get function will
always return a jQuery object because it calls apply to the cached
function "_get" and calls "each" on the returned object.  This doesn't
seem to be the case if get is called via the methods described in the
public API (e.g. $('something').get(0)).  Internal get requests are
different in that they are usually (always?) passing Arrays, and that
situation is handled in the original get function.  I was getting
errors that the "each" function was not defined at the end of all my
jQuery calls because of this (only tested in FF 1.5.0.7).  I may have
some other environment, or perhaps the meta plugin was designed to
work only with the most recent version from SVN.  But this was the
case when running with jQuery 1.0.3.

I added a line which appears to have fixed it.  I took the check for
an array as the argument sent to get from the internal jQuery.fn.get
and used it in the new get as defined by the plugin.

The first few lines of the new jQuery.fn.get function become:

jQuery.fn.get = function(){
        return (arguments[0] && arguments[0].constructor == Array) ?
                // we're dealing with an internal jQuery request
                this._get.apply( this, arguments )
                        .each(function(){...

And the last few lines become:

                                this.metaDone = true;
                        }) :
                // we're returning an object
                this._get.apply( this, arguments );

I'm not nearly as versed in jQuery as many of you, so please tell me
if I'm way off here (entirely possible).  But this appears to fix the
issues I was seeing, and the plugin appears to still function.  I'll
send a zipped version of my mods to the list if there is any interest.

Thanks,

Paul McLanahan

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to