Bug Tracker

Opened 15 years ago

Closed 15 years ago

#1480 closed bug (fixed)

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.

Change History (2)

comment:1 Changed 15 years ago by flesler

Keywords: isfunction added
need: ReviewCommit
Owner: set to 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 ?

comment:2 Changed 15 years ago by flesler

Resolution: fixed
Status: assignedclosed

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

Note: See TracTickets for help on using tickets.