08 2011 档案
jQuery1.6 类型判断
摘要:首先定义了全局变量class2type = {};rdigit = /\d/,//正则判断是否是数字toString = Object.prototype.toString;通过jQuery.each,定义class2type的属性和值: jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { class2type[ "[object " + name + "]" ]
阅读全文
jQuery1.6 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; if ( typeof target === "boolean" ) {//深度复制 deep = target; target = arguments[1] || {}; i = 2; } if ( typeof target
阅读全文
jQuery isPlainObject
摘要:第一次看jQuery的源代码,转得好晕,苦逼的isPlainObject, 判断是否为纯粹的对象isPlainObject: function( obj ) { if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {//为空,节点,window对象,非object返回false; return false; } if ( obj.constructor && !hasOwn.call(obj, "constructor"
阅读全文
浙公网安备 33010602011771号