Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#7180 closed bug (worksforme)

Plugin throws error: "jQuery.type is not a function"

Reported by: c.barr Owned by:
Priority: undecided Milestone: 1.4.3
Component: unfiled Version: 1.4.3
Keywords: Cc:
Blocked by: Blocking:

Description

I'm sorry I don't have a lot of information on this, but when testing out 1.4.3rc2 with the NyroModal plugin (http://nyromodal.nyrodev.com/) I get the following error: jQuery.type is not a function on line 527, which is the isPlainObject function.

The webkit console gives a bit more information:

Uncaught TypeError: Property 'type' of object function ( selector, context ) {
    // The jQuery object is actually just the init constructor 'enhanced'
    return new jQuery.fn.init( selector, context );
} is not a function

This may be more of an issue with that plugin rather than jQuery, but it did work just fine in 1.4.2, and the 1.4.3rc2 release seems to break this pretty bad.

Here's a demo of it in action. http://jsbin.com/obecu3/2/edit

Unfortunately, you might have to actually dig into the source of the plugin to see where this is being called, I'm not familiar enough with it to know.

Change History (7)

comment:1 Changed 9 years ago by john

Resolution: worksforme
Status: newclosed

I ran your demo in both Firefox and Safari and didn't see the error that you mention. Perhaps you meant to link to a different demo?

comment:2 Changed 9 years ago by c.barr

Really? I just double checked and the demo still throws an error.

Try going to the page, opening up the webkit/Firebug console and then clicking the "click me" link

comment:3 Changed 9 years ago by dmethvin

Resolution: worksforme
Status: closedreopened

I can repro in Firefox so I'm reopening. It seems to be extend()ing over the jQuery object, clobbering jQuery.type in the process.

comment:4 Changed 9 years ago by addyosmani

I've also been able to repro this in FireFox and Safari. (in case an extra confirmation assists)

comment:5 Changed 9 years ago by dmethvin

Resolution: worksforme
Status: reopenedclosed

It seems like this is a bug in the packed version only, if I switch the test case to the unpacked version it works correctly. In the packed version (only!) the default settings for the plugin are extended into the jQuery object; one of the settings (type) is now a jQuery method it is clobbered. Since the unpacked version works and doesn't clobber jQuery's methods I have to think something got corrupted during packing of the plugin. You might want to try one of the other compression tools like Google Closure Compiler or YUI Compressor instead.

comment:6 Changed 9 years ago by c.barr

Odd because i fist found this occurring on the unpacked version on my machine. But you're right, using the uncompressed version in that demo does make it work. I may have to double check some things tomorrow and see if I can still get this to happen in the unpacked version.

comment:7 Changed 9 years ago by jimbobmcgee

I believe that, at line #341 in the unpacked source of the nyroModal plugin (looking at v1.6.2 - 23-Feb-2010), a call to $.extend(...) is missing an argument.

Apologies for the code-post but, if I've read both nyroModal and jQuery source correctly it correctly, the line:

callingSettings = $.extend(true, settings);

should read:

callingSettings = $.extend(true, {}, settings);

The original line has no declared target, so would extend the jQuery object itself; adding the empty object as a target tells jQuery to clone the settings parameter into the callingSettings object, which I believe is the intention of the line.

I don't know whether the $-extending 'overload' for $.extend existed before jQuery 1.4.3 (I expect it did) or if the omission of the {} argument is new to nyroModal 1.6.2 (I don't have visibility of the source diffs) but I have filed a bug on the nyroModal issue tracker to alert the author to the issue, in case I am mistaken.

Note: See TracTickets for help on using tickets.