Copy Code code as follows:
Jquery.extend = JQuery.fn.extend = function () {
var options, name, SRC, copy, Copyisarray, clone,
target = Arguments[0] | | {},
i = 1,
Length = Arguments.length,
Deep = false;
Handle a deep copy situation
if (typeof target = = "Boolean") {
Deep = target;
target = Arguments[1] | | {};
Skip the Boolean and the target
i = 2;
}
Handle case as Target is a string or something (possible in deep copy)
if (typeof target!== "Object" &&!jquery.isfunction (target)) {
target = {};
}
Extend JQuery itself if only one argument is passed
if (length = = i) {
target = this;
I.;
}
for (; i < length; i++) {
//only deal with Non-n ull/undefined Values
if ((options = arguments[i])!= null) {
&NBSP;&N bsp; //Extend The base object
for (name in options) {
src = target[name];
copy = options[ Name];
//Prevent Never-Ending Loop
if (target = = copy) {
continue;
}
//recurse if we re Merging plain objects or arrays
if (deep && copy && jquery.isplainobject (copy) | | (Copyisarray = Jquery.isarray (copy)) ) {
if (copyisarray) {
Copyisarray = false;
clone = src && jquery.isarray (src)? SRC: [];
} else {
clone = src && jquery.isplainobject (src)? src: {};
}
Never move original objects, clone them
target[name] = Jquery.extend (deep, clone, copy);
Don ' t bring in undefined values
else if (copy!== undefined) {
target[name] = copy;
}
}
}
}
Return the Modified Object
return target;
};