Side navigation
#997 closed bug (fixed)
Opened February 24, 2007 07:09AM UTC
Closed February 25, 2007 05:41PM UTC
Last modified June 21, 2007 04:34AM UTC
isFunction returns "true" on A element
Reported by: | jeffkretz | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | 1.1.2 |
Component: | core | Version: | 1.1.1 |
Keywords: | isFunction | Cc: | |
Blocked by: | Blocking: |
Description
When an A element has an href with "function" as a part of its path, the jQuery.isFunction method returns "true" incorrectly.
isFunction: function( fn ) { return !!fn && typeof fn != "string" && typeof fn[0] == "undefined" && /function/i.test( fn + "" ); },
This is due to the fact that adding an A element to "" returns its href.
As an example, the following code will throw an exception, because the jQuery initializer tests for the item being a function, and tries to fire it as a document.ready:
$('a').each( function() { var a = $(this); } );
Sample page showing this error: http://www.scorpiontechnology.com/sjo/functiontest.html
Error shows up in IE6, IE7, FF and Opera.
JK
Fixed in Revision 1421.