jQuery extend 的简单实例 |
本文标签:jQuery,extend 复制代码 代码如下: 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 // Handle case when target is a string or something (possible in deep copy) // extend jQuery itself if only one argument is passed for ( ; i < length; i++ ) { // Prevent never-ending loop // Recurse if were merging plain objects or arrays } else { // Never move original objects, clone them // Dont bring in undefined values // Return the modified object |