zepto的原型  $.fn  属性:

constructor              //构造行数
forEach: emptyArray.forEach,    //都是原生数组的函数reduce: emptyArray.reduce,push: emptyArray.push,sort: emptyArray.sort,splice: emptyArray.splice,indexOf: emptyArray.indexOf,

 

concat                  //合并数组,这里还包含了合并节点集合
add                    //添加节点集合
is                    //匹配是否包含该选择器
      find: function(selector){var result, $this = thisif (!selector) result = $()else if (typeof selector == 'object')result = $(selector).filter(function(){var node = thisreturn emptyArray.some.call($this, function(parent){return $.contains(parent, node)})})else if (this.length == 1) result = $(zepto.qsa(this[0], selector))else result = this.map(function(){ return zepto.qsa(this, selector) })return result},

  

emptyArray.some()     http://www.cnblogs.com/jiebba/p/6514067.html   可以看看js几种遍历不同
pluck              根据属性来返回节点集合
   // 设置宽高;['width', 'height'].forEach(function(dimension){var dimensionProperty =dimension.replace(/./, function(m){ return m[0].toUpperCase() })$.fn[dimension] = function(value){var offset, el = this[0]if (value === undefined) return isWindow(el) ? el['inner' + dimensionProperty] :isDocument(el) ? el.documentElement['scroll' + dimensionProperty] :(offset = this.offset()) && offset[dimension]else return this.each(function(idx){el = $(this)el.css(dimension, funcArg(this, value, idx, el[dimension]()))})}})

  

 //添加函数`after`, `prepend`, `before`, `append`,
 adjacencyOperators.forEach(function(operator, operatorIndex) {var inside = operatorIndex % 2 //=> prepend, append$.fn[operator] = function(){// arguments can be nodes, arrays of nodes, Zepto objects and HTML stringsvar argType, nodes = $.map(arguments, function(arg) {var arr = []

  

 zepto.Z.prototype = Z.prototype = $.fn

  

绑定到原型上面

    window.Zepto = Zeptowindow.$ === undefined && (window.$ = Zepto)//绑定在全局

  

代码仅供参考,具体功能可以自己扩展。

个人博客 :很多好用的 npm 包 , 可以看看  https://gilea.cn/ 

http://www.cnblogs.com/jiebba/p/6529854.html

http://www.cnblogs.com/jiebba    我的博客,来看吧!

如果有错误,请留言修改下 哦!

非常适合新手的jq/zepto源码分析05相关推荐

  1. Mybatis3源码分析(05)-加载Configuration-加载MappedStatement

    2019独角兽企业重金招聘Python工程师标准>>> Mybatis3源码分析(05)-加载Configuration-加载MappedStatement 博客分类: java m ...

  2. Zepto源码分析-event模块

    源码注释 // Zepto.js // (c) 2010-2015 Thomas Fuchs // Zepto.js may be freely distributed under the MIT l ...

  3. Zepto源码分析-zepto模块

    源码 //Zepto.js//(c) 2010-2015 Thomas Fuchs//Zepto.js may be freely distributed under the MIT license. ...

  4. llvm libLLVMCore源码分析 05 - Instruction Class

    源码路径 llvm\include\llvm\IR\Instruction.h llvm\include\llvm\IR\Instruction.def llvm\include\llvm\IR\In ...

  5. Zepto源码分析-架构

    构造函数 Zepto.js 是专门为智能手机浏览器推出的javascript库, 拥有与和jQuery相似的语法. 它的优点是精简,压缩后5-10K. 不支持IE MIT开源协议 结构   http: ...

  6. Libev源码分析05:Libev中的绝对时间定时器

    Libev中的超时监视器ev_periodic,是绝对时间定时器,不同于ev_timer,它是基于日历时间的.比如如果指定一个ev_periodic在10秒之后触发(ev_now() + 10),然后 ...

  7. 读Zepto源码之操作DOM

    2019独角兽企业重金招聘Python工程师标准>>> 这篇依然是跟 dom 相关的方法,侧重点是操作 dom 的方法. 读Zepto源码系列文章已经放到了github上,欢迎sta ...

  8. 读Zepto源码之代码结构

    虽然最近工作中没有怎么用 zepto ,但是据说 zepto 的源码比较简单,而且网上的资料也比较多,所以我就挑了 zepto 下手,希望能为以后阅读其他框架的源码打下基础吧. 源码版本 本文阅读的源 ...

  9. 读Zepto源码之Deferred模块

    Deferred 模块也不是必备的模块,但是 ajax 模块中,要用到 promise 风格,必需引入 Deferred 模块.Deferred 也用到了上一篇文章<读Zepto源码之Callb ...

最新文章

  1. RavenDB FS 安装使用 介绍
  2. srm linux字符界面,如何使用srm安全的删除Linux中的文件
  3. 5.1 Tensorflow:图与模型的加载与存储
  4. 华为交换机netstream配置
  5. requestmapping配置页面后_@RequestMapping接口及页面乱码问题
  6. numpy 数组抽取_Python 关于NumPy的用法介绍
  7. c3p0 高并发mysql 连接sleep情况
  8. C#引用office库
  9. Canvas scale- 缩放
  10. 最近项目中遇到的一个算法挑战
  11. vSphere5.1升级5.5(二)——升级Esxi主机及vmware tools
  12. Activity 切换 动画
  13. 异常Throwable类
  14. 云南昭通暴雨强度公式_玉溪市中心城区暴雨强度公式
  15. python 爬虫之路教程
  16. js数组操作方法 concat
  17. 苹果支付在哪里设置_微信刷脸支付怎么开通,在哪里设置?
  18. 博客:固定位置增加二维码
  19. 如何在html里面搜索代码,怎样在网页里查找关键字
  20. 429. N 叉树的层序遍历 c++ 队列

热门文章

  1. 每天学一点flash(76)百度MP3音乐APi接口使用
  2. Final Project Proposal ——陈稳霖
  3. Red Hat Enterprice Linux 5测试 Qt 4.7 Qt Creator(二)
  4. Android Studio项目目录结构介绍
  5. linux运维实战练习-2015年8月30日课程作业(练习)安排
  6. 【工具】 原版完美激活 Flash builder 4.7 【非破解激活】
  7. java抽象类的说明
  8. 夜猫专业黑帽seo优化服务团队
  9. Go语言详细介绍:logo和版本
  10. java B2B2C Springcloud仿淘宝电子商城系统