Skip to main content

Bug Tracker

Side navigation

#1480 closed bug (fixed)

Opened August 12, 2007 08:00AM UTC

Closed May 14, 2008 08:11PM UTC

isFunction fails in certain cases

Reported by: dmitriid Owned by: flesler
Priority: trivial Milestone: 1.2.4
Component: core Version: 1.1.3
Keywords: isfunction Cc:
Blocked by: Blocking:

I'm not sure how relevant it is, but:

var a, b, c;

a = /^\\dfunction\\d/;
b = new String('Wow, J(ava)Script is soooo functional...');
c = ['method', 'function', 'object'];
c.constructor = 'Lego';

alert([$.isFunction(a), $.isFunction(b), $.isFunction(c)]); // -> true, true, true!!!

If you write

 a = /^\\dunction\\d/; 
then isFunction(a) returns false (as it probably should).

Marked the bug as minor as it doesn't seem to affect how jQuery behaves overall.

Attachments (0)
Change History (2)

Changed May 11, 2008 10:57PM UTC by flesler comment:1

keywords: → isfunction
need: ReviewCommit
owner: → flesler
priority: minortrivial
status: newassigned

(a) and (c) are REALLY irrelevant, specially (c).

You can always find a way around a hack, that doesn't mean you need to expect it.

The 2nd case with the string can actually happen, though it's pretty specific too.

The regex can be replaced to:

/^ ?function/

IE seems to add a whitespace at position 0, the insensitive case is really neccesary ?

Changed May 14, 2008 08:11PM UTC by flesler comment:2

resolution: → fixed
status: assignedclosed

Fixed at [5601], none of these 3 cases should yield true now.