aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2006-10-15 03:11:02 +0000
committerJohn Resig <jeresig@gmail.com>2006-10-15 03:11:02 +0000
commitc9511ef948ec3fd58bfd0af8898ef66abdc80255 (patch)
treea2abc10f9762737cdf9fc007929c838dae3c3898
parentaf961d58c244224c14f3bb519214485cb670c64d (diff)
downloadjquery-c9511ef948ec3fd58bfd0af8898ef66abdc80255.tar.gz
jquery-c9511ef948ec3fd58bfd0af8898ef66abdc80255.zip
Added fix for jQuery.extend( Object, null || undefined ) lapsing back to just jQuery.extend( Object ).
-rw-r--r--src/jquery/jquery.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js
index 31dde991d..6b05a0605 100644
--- a/src/jquery/jquery.js
+++ b/src/jquery/jquery.js
@@ -1297,8 +1297,17 @@ jQuery.fn = jQuery.prototype = {
* @cat Javascript
*/
jQuery.extend = jQuery.fn.extend = function(obj,prop) {
+ // Watch for the case where null or undefined gets passed in by accident
+ if ( arguments.length > 1 && (prop === null || prop == undefined) )
+ return obj;
+
+ // If no property object was provided, then we're extending jQuery
if ( !prop ) { prop = obj; obj = this; }
+
+ // Extend the base object
for ( var i in prop ) obj[i] = prop[i];
+
+ // Return the modified object
return obj;
};