Skip to main content

Bug Tracker

Side navigation

#7180 closed bug (worksforme)

Opened October 13, 2010 05:11PM UTC

Closed October 14, 2010 01:23AM UTC

Last modified March 15, 2012 12:09PM UTC

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.

Attachments (0)
Change History (7)

Changed October 13, 2010 05:23PM UTC by john comment:1

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?

Changed October 13, 2010 05:27PM UTC by c.barr comment:2

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

Changed October 13, 2010 05:50PM UTC by dmethvin comment:3

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.

Changed October 13, 2010 06:01PM UTC by addyosmani comment:4

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

Changed October 14, 2010 01:23AM UTC by dmethvin comment:5

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.

Changed October 14, 2010 01:30AM UTC by c.barr comment:6

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.

Changed December 01, 2010 06:15PM UTC by jimbobmcgee comment:7

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.