- 浏览: 263375 次
- 性别:
- 来自: 深圳
最新评论
-
zhaoaifeiyu:
楼主真是幽默,不过我看这个帖子居然是13年的。。。 我感觉我 ...
Java使用Tess4J 进行图片文字识别 笔记 -
wangzihui:
你好,能给我一个完整的代码么?我按照你的写出来后,汉字全是乱码 ...
Java使用Tess4J 进行图片文字识别 笔记 -
piaolin7:
[color=orange] ...
Java使用Tess4J 进行图片文字识别 笔记 -
xulei1992:
打开只有一个读到一半的进度条啊亲
连连看-js -
chenhailong:
楼主请问下你上面那个图是怎么画的?是用什么工具?
Java7语法新特性
jQuery 分析中出了很多疑问,都不能解决,代码能看懂,但搞不明白为什么那么使用.这是一件很头痛的事儿.
jQuery 是一个很好的js库,优秀的原因是因为它有个好的思想,而我却看不明白.
/* * jQuery1.4.1 代码分析 isw2 zhoux */ //多库共存,数据缓存,队列控制 (function( window, undefined ) { var jQuery = function( selector, context ) { _jQuery = window.jQuery,// 记录原始的jQuery对象用于多库共存 _$ = window.$// 记录原始的$对象用于多库共存 }; // 多库共存 // 括展jQuery 对象本身 jQuery.extend({ noConflict: function( deep ) { window.$ = _$;// $的控制权让渡给第一个实现它的那个库 if ( deep ) { window.jQuery = _jQuery;// jQuery的控制权让渡给第一个实现它的那个库,这也是jQuery 多用jQuery 而不用$的原因 } return jQuery; } }); // 数据缓存 // 括展jQuery 方法 jQuery.fn.extend({ data: function( key, value ) { if ( typeof key === "undefined" && this.length ) {// key 无值,通过length 判断数组 return jQuery.data( this[0] ); } else if ( typeof key === "object" ) { return this.each(function() { jQuery.data( this, key ); }); } var parts = key.split("."); parts[1] = parts[1] ? "." + parts[1] : ""; if ( value === undefined ) { var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);// ?为会么要triggerHandler? if ( data === undefined && this.length ) { data = jQuery.data( this[0], key ); } return data === undefined && parts[1] ? this.data( parts[0] ) : data; } else { return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function() {// 为什么要trigger setData? jQuery.data( this, key, value ); }); } }, removeData: function( key ) { return this.each(function() { jQuery.removeData( this, key ); }); } }); var expando = "jQuery" + now(), uuid = 0, windowData = {};// 初始化时expando获取唯一值,在jQuery // 中全局 var emptyObject = {}; function now() { return (new Date).getTime(); } jQuery.extend({ cache: {}, expando:expando, noData: {// 不可存放数据的element 对象nodeName "embed": true,// 多媒体 "object": true, "applet": true }, data: function( elem, name, data ) {// 在元素上存放数据 if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {// 检查节点是否可以存放Date return; } elem = elem == window ? windowData : elem; var id = elem[ expando ], cache = jQuery.cache, thisCache; if ( !name && !id ) {// name,elem.expando为空,用于jQuery.data(elem),且elem data == null情况 return null; } if ( !id ) {// elem.expando 为空 id = ++uuid;// id !=null 且唯一 } if ( typeof name === "object" ) { elem[ expando ] = id; thisCache = cache[ id ] = jQuery.extend(true, {}, name);// ? } else if ( cache[ id ] ) {// 如果已有值 thisCache = cache[ id ];// 此时cache[id]的值为thisCache } else if ( typeof data === "undefined" ) { thisCache = emptyObject; } else { thisCache = cache[ id ] = {};// 此时cache[id]的值为thisCache } if ( data !== undefined ) {// 防止一个undefined的值覆盖原有数据 elem[ expando ] = id; thisCache[ name ] = data;// 即cache[id]=data } /* * var value = $.cache; * for(var temp in value){ * for(var tempA in value[temp]){ * alert("$.cache["+tempA+"]:"+value[temp][tempA]); * } } * 可以查看结果 */ return typeof name === "string" ? thisCache[ name ] : thisCache; }, removeData: function( elem, name ) { if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { return; } elem = elem == window ? windowData : elem; var id = elem[ expando ], cache = jQuery.cache, thisCache = cache[ id ]; if ( name ) { if ( thisCache ) {// 根据name 删除,否则删除expando delete thisCache[ name ];// delete if ( jQuery.isEmptyObject(thisCache) ) {//isEmptyObject 测试对象是否是空对象 jQuery.removeData( elem ); } } } else {// 通过delete 删除expando 如果不能则用removeAttribute(javascript 方法)操作 try { delete elem[ expando ]; } catch( e ) { if ( elem.removeAttribute ) { elem.removeAttribute( expando ); } } delete cache[ id ]; } } }); //队列控制 // 括展jQuery 对象本身 jQuery.extend({ queue: function( elem, type, data ) { if ( !elem ) { return; } type = (type || "fx") + "queue"; var q = jQuery.data( elem, type );//调用jQuery.data()查询elem 上type 的数据 if ( !data ) { return q || []; } if ( !q || jQuery.isArray(data) ) { q = jQuery.data( elem, type, jQuery.makeArray(data) );//调用jQuery.data(),存入data } else { q.push( data ); } return q; }, dequeue: function( elem, type ) { type = type || "fx"; var queue = jQuery.queue( elem, type ), fn = queue.shift(); if ( fn === "inprogress" ) { fn = queue.shift(); } if ( fn ) { if ( type === "fx" ) { queue.unshift("inprogress"); } fn.call(elem, function() { jQuery.dequeue(elem, type); }); } } }); // 括展jQuery 方法 jQuery.fn.extend({ queue: function( type, data ) { if ( typeof type !== "string" ) { data = type; type = "fx"; } if ( data === undefined ) { return jQuery.queue( this[0], type ); } return this.each(function( i, elem ) { var queue = jQuery.queue( this, type, data ); if ( type === "fx" && queue[0] !== "inprogress" ) { jQuery.dequeue( this, type ); } }); }, dequeue: function( type ) { return this.each(function() { jQuery.dequeue( this, type ); }); }, clearQueue: function( type ) { return this.queue( type || "fx", [] ); } }); window.jQuery = window.$ = jQuery; })
发表评论
-
JavaScript 对象
2013-06-13 17:50 855<html> <head> &l ... -
ajax小结
2010-11-11 08:20 1110昨天笔试,杯具,SQL的 ... -
Json 在 IE6下出错
2010-09-17 15:59 1404前些天写的js 在IE6下出错,因为电脑上用的是IE8+ff ... -
连连看-js
2010-07-17 09:49 2021前几天写了,算是一个小小的总结吧. //连连看 2010. ... -
jQuery1.4.1 代码分析(2对象访问,插件机制)
2010-07-09 16:57 1151jQuery 的核心分为 jQuery 核心函数 j ... -
jQuery1.4.1 代码分析(1核心函数)
2010-07-08 15:29 1076学习一段时间了,算是总结一下吧.有部分暂时不能完全看明白.用& ... -
JavaScript 随手小记
2010-07-06 15:51 968前些时间看了<JavaScript 权威指南>,信 ... -
jQuery 实现上下,左右滑动
2010-07-01 11:06 21129前几天的任务:http://t.sina.com.cn/ 的 ... -
JavaScript 写的一个贪吃蛇
2010-06-08 12:33 918这几天闲来无事写的。 算是总结了一下这段时间以来学到的 ... -
jQuery 表格排序
2010-06-02 16:27 2214<!DOCTYPE html PUBLIC " ... -
javaScript 实现的年月日三级联动
2010-05-29 01:26 2370// JavaScript Document 2010-06 ... -
Google map api的使用
2010-04-30 13:42 1621google map api google map ... -
JQuery 事件(3)
2010-04-29 15:09 977JS美化,压缩http://js.clicki ... -
JQuery 选择器(2)
2010-04-28 17:31 905<!DOCTYPE html PUBLIC " ... -
JQuery 的使用(1)
2010-04-28 11:15 1113<!DOCTYPE HTML PUBLIC " ... -
打开MSN,QQ对话框
2010-03-13 11:34 3087下面是一个用超链打开QQ临时对话框的代码 <html& ... -
DIV和Image 的一些JavaScript 操作
2010-02-25 16:42 1460<html> <head> < ... -
Javascript 中正则表达示的使用
2010-02-09 14:55 901<script language="javas ... -
JavaScript 中自定义对象
2010-02-08 11:48 774http://www.ccvita.com/94.html ... -
JavaScript 操作CSS类
2010-02-05 16:59 1457<!DOCTYPE html PUBLIC " ...
相关推荐
JQuery1.4.1 文件包。包含三个文件jquery-1.4.1.js jquery-1.4.1.min.js jquery-1.4.1-vsdoc.js
jquery 1.4.1jquery 1.4.1jquery 1.4.1jquery 1.4.1jquery 1.4.1
jQuery 1.4.1 中文版参考电子书
jquery1.4.1使用手册
NULL 博文链接:https://canrry.iteye.com/blog/712066
jquery 开发中文文档,供开发人员使用。。
JQuery1.4.1.js 文件包。包含三个文件jquery-1.4.1.js jquery-1.4.1.min.js jquery-1.4.1-vsdoc.js
最新版的jquery1.4.1中文帮助。
jQuery1.4.1 API 中文参考手册,速查表,记得右键属性下进行设置。
jQuery 1.4.1 API 中文参考手册.chm
2.3 数据缓存 27 2.3.1 data([name]) 27 2.3.2 data(name, value) 28 2.3.3 data(obj) 29 2.3.4 removeData(name) 29 2.3.5 jQuery.data(element, key, value) 29 2.3.6 jQuery.data([element], [key]) 30 2.4 队列...
jQuery 1.4.1 速查表 jQueryAPI,很好的jquery工具书,查询手册,包含了jquery所有的功能,很全面的
JQuery1.4.1 UI ,JS ,中文API文档 学习收集
jQuery1.4.1.chm中文API,版本:jQuery1.4.1.chm,解压即食,
jQuery1.4.1中文速查参考! jQuery1.4.1中文速查参考 jQuery1.4.1中文速查参考
Jquery下载,用Jquery的朋友有福了..我找了好久才找到的.. 诶.杯具阿
jQuery1.4.1中文参考(chm),非常好用。
数据缓存 data([name] , [value]) data(obj) removeData(name) $.data([el], [key], [val]) 队列控制 queue(name ,[cb|queue]) dequeue(name) clearQueue([queueName]) 插件机制 jQuery.fn.extend(object) ...