美文网首页
jQuery的init设计哲学

jQuery的init设计哲学

作者: 饮罢飞雪 | 来源:发表于2016-09-04 12:36 被阅读0次

本文主要介绍的是jQuery2和jQuery3的init函数的区别

首先来看一下$('xxx')的输出

Paste_Image.png

很明显jQuery3比jQuery2少了contentselector
OK:既然是你自己的选择的元素,就不需要再暴露一次.

接下来,对比一下源码

  1. 取字符串方法: []charAt()
    区别请戳这里
Paste_Image.png
  1. 省去了contentselector
Paste_Image.png

相关文章

网友评论

      本文标题:jQuery的init设计哲学

      本文链接:https://www.haomeiwen.com/subject/xdylettx.html