Skip to main content

Bug Tracker

Side navigation

#180 closed bug (fixed)

Opened September 05, 2006 05:19PM UTC

Closed September 22, 2006 09:44PM UTC

Last modified June 20, 2007 01:20AM UTC

.constructor == Function is not enough

Reported by: Owned by:
Priority: major Milestone: 1.0
Component: core Version: 1.0
Keywords: Cc:
Blocked by: Blocking:

constructor sometimes represented as {...},so compare it with "Function" is not enough.Something as simple as typeof(data)=="function" will be suffice.Look at $.get() function for example.

I'm using 1.0.1 with IE7 on Vista RC1.By the way,why you're using sometimes typeof() and sometimes .constructor,I suggest to use only one of these for convenience;-)

Attachments (0)
Change History (5)

Changed September 09, 2006 05:47PM UTC by joern comment:1

component: ajaxcore

".constructor ==" occurs 17 times in the jQuery core, ".constructor == Function" 4 times. I'm not sure in which case this is a problem, but if there is any, it shouldn't be too hard to fix.

Changed September 11, 2006 03:37PM UTC by sa.cesare@gm comment:2

Please,fix it if you can-it's not working in .htc context.

Changed September 11, 2006 06:55PM UTC by dave.methvin comment:3

This explains it a bit:

The .htc's scripting engine isn't the same as the main page's (and jQuery) scripting engine. Since .constructor basically uses the engines address of the Function object and they are two different engines, the two are not equal. Instead, use typeof(x)=="function" as the original poster said.

Changed September 12, 2006 08:19PM UTC by joern comment:4

Dave, if I get that right, the blog entry you link to, actually says that the instanceof operator won't work in this case.

Anyway, can someone provide a test case for this? That would be a great help to solve this.

Changed September 22, 2006 09:44PM UTC by joern comment:5

resolution: → fixed
status: newclosed

Fixed in SVN (rev. 341).