Made some syntax tweaks to core.js.

This commit is contained in:
John Resig 2009-07-19 19:55:21 +00:00
parent b953c1d50a
commit 29ff710c9b

View file

@ -251,10 +251,15 @@ jQuery.extend = jQuery.fn.extend = function() {
if ( deep && copy && typeof copy === "object" && !copy.nodeType ) { if ( deep && copy && typeof copy === "object" && !copy.nodeType ) {
var clone; var clone;
if( src ) clone = src; if ( src ) {
else if( jQuery.isArray(copy) ) clone = [ ]; clone = src;
else if( jQuery.isObject(copy) ) clone = { }; } else if ( jQuery.isArray(copy) ) {
else clone = copy; clone = [];
} else if ( jQuery.isObject(copy) ) {
clone = {};
} else {
clone = copy;
}
// Never move original objects, clone them // Never move original objects, clone them
target[ name ] = jQuery.extend( deep, clone, copy ); target[ name ] = jQuery.extend( deep, clone, copy );
@ -298,8 +303,9 @@ jQuery.extend({
}, },
isEmptyObject: function( obj ) { isEmptyObject: function( obj ) {
for(var name in obj) for ( var name in obj ) {
return false; return false;
}
return true; return true;
}, },
@ -318,6 +324,7 @@ jQuery.extend({
script = document.createElement("script"); script = document.createElement("script");
script.type = "text/javascript"; script.type = "text/javascript";
if ( jQuery.support.scriptEval ) { if ( jQuery.support.scriptEval ) {
script.appendChild( document.createTextNode( data ) ); script.appendChild( document.createTextNode( data ) );
} else { } else {