jquery运行的闭包中生成变量expando = 'jQuery' + new Date
然后在闭包中弄了1个数
每次调data的时候+1
往元素的expando 属性上挂 这个数
然后将属性存到$.cache中
键为元素的expando对应的数字
值为存储的东西
(function($) {
var expando = 'jQuery' + new Date;
var num = 0;
$.fn.data = function(a,b) {
return this.each(function() {
if(!b) {
if(!this.expando) {
this.expando = ++num;
$.cache[num] = {};
}
$.cache[num][a] = b;
} else {
if(!this.expando) return null;
return $.cache[this.expando][a];
}
});
}
})(jQuery);