争怎路由网:是一个主要分享无线路由器安装设置经验的网站,汇总WiFi常见问题的解决方法。

zepto是什么

时间:2024/4/29作者:未知来源:争怎路由网人气:

'' return dom } // `$.zepto.isZ` should return `true` if the given object is a Zepto // collection. This method can be overriden in plugins. //判断给定的参数是否是Zepto集 zepto.isZ = function(object) { return object instanceof zepto.Z } // `$.zepto.init` is Zepto's counterpart to jQuery's `$.fn.init` and // takes a CSS selector and an optional context (and handles various // special cases). // This method can be overriden in plugins. zepto.init = function(selector, context) { // If nothing given, return an empty Zepto collection if (!selector) return zepto.Z() //没有参数,返回空数组 //如果selector是个函数,则在DOM ready的时候执行它 else if (isFunction(selector)) return $(document).ready(selector) //如果selector是一个zepto.Z实例,则直接返回它自己 else if (zepto.isZ(selector)) return selector else { var dom //如果selector是一个数组,则将其里面的null,undefined去掉 if (isArray(selector)) dom = compact(selector) //如果selector是个对象,注意DOM节点的typeof值也是object,所以在里面还要再进行一次判断 else if (isObject(selector)) //如果是申明的对象,如{}, 则将selector属性copy到一个新对象,并将结果放入数组 //如果是该对象是DOM,则直接放到数组中 dom = [isPlainObject(selector) ? $.extend({}, selector) : selector], selector = null //如果selector是一段HTML代码片断,则将其转换成DOM节点 else if (fragmentRE.test(selector)) dom = zepto.fragment(selector.trim(), RegExp.$1, context), selector = null //如果存在上下文context,则在上下文中查找selector,此时的selector为普通的CSS选择器 else if (context !== undefined) return $(context).find(selector) //如果没有给定上下文,则在document中查找selector,此时的selector为普通的CSS选择器 else dom = zepto.qsa(document, selector) //最后将查询结果转换成zepto集合 return zepto.Z(dom, selector) } } // `$` will be the base `Zepto` object. When calling this // function just call `$.zepto.init, which makes the implementation // details of selecting nodes and creating Zepto collections // patchable in plugins. $ = function(selector, context) { return zepto.init(selector, context) } //扩展,deep表示是否深度扩展 function extend(target, source, deep) { for (key in source) //如果深度扩展 if (deep && (isPlainObject(source[key])

关键词:zepto是啥




Copyright © 2012-2018 争怎路由网(http://www.zhengzen.com) .All Rights Reserved 网站地图 友情链接

免责声明:本站资源均来自互联网收集 如有侵犯到您利益的地方请及时联系管理删除,敬请见谅!

QQ:1006262270   邮箱:kfyvi376850063@126.com   手机版