一

{"type":"编程笔记"}


  • Home

  • Archives
  • Search

jquery-1.4.2 manipulation部分源码分析

Posted on 2014-08-01   |   In jquery

manipulation部分源码分析

Read more »

jquery-1.4.2 fx部分源码分析

Posted on 2014-08-01   |   In jquery

###Examples of jQuery.fn.fx

Read more »

jquery-1.4.2 event部分源码分析

Posted on 2014-07-31   |   In jquery

下面是Dean Edwards关于javascript事件机制处理的源码

Read more »

jquery-1.4.2 dimensions部分源码分析

Posted on 2014-07-31   |   In jquery

jQuery.fn.width()和jQuery.fn.css("width")的区别

注意jQuery.fn.width()方法返回的是不带px单位的纯宽度数值,而jQuery.fn.css("width")方法返回的则是通过style计算得到的是带px单位的字符串,并且在chrome/safari中,这二个方法返回的数值也会因为DOM对象出现滚动条而不一样:jQuery.fn.width()是通过offsetWidth减去border和padding的宽度得到的,所以不会受滚动条的影响,而jQuery.fn.css("width")是由window.getComputedStyle()方法计算得到。

这二个方法运行结果的差异可以从jQuery.fn.offset()源码阅读笔记中查看。

Read more »

jquery-1.5 deferred部分源码分析

Posted on 2014-07-31   |   In jquery

关于1.5中新引进来的jQuery.Deferred方法,在官方文档中的说明摘录部分如下,这个方法实现是基于CommonJS Promises/A的设计模式,这个设计模式主要用于异步编程。其中一种处理模式称为promise,它代表了一种可能会长时间运行而且不一定必须完整的操作的结果。这种模式不会阻塞和等待长时间的操作完成,而是返回一个代表了承诺的(promised)结果的对象。

One pattern is a promise, which represents the result of a potentially long running and not necessarily complete operation. Instead of blocking and waiting for the long-running computation to complete, the pattern returns an object which represents the promised result.

关于Deferred/Promise的一些外部资源:

  1. Deferred Object of jQuery
  2. dojo.Deferred
  3. JavaScript异步编程的Promise模式
  4. Asynchronous Programming in JavaScript with “Promises”
  5. CommonJS Promise/A
  6. jQuery.Deferred对象 -- JavaScript 标准参考教程(alpha),这份说明是后来网上看到补上的,写得很好。

jQuery的Deferred实现代码量不多,但要看懂源代码还是相当的费神,回调非常多:

Read more »
1…303132…99
yuweijun

yuweijun

492 posts
12 categories
RSS
GitHub Twitter
© 2021 yuweijun
Powered by Hexo
Theme - NexT.Mist.KISS