) { selector = selector.trim() // If it's a html fragment, create nodes from it // Note: In both Chrome 21 and Firefox 15, DOM error 12 // is thrown if the fragment doesn't begin with < if (selector[0] == '<' && fragmentRE.test(selector)) dom = zepto.fragment(selector, RegExp.$1, context), selector = null // If there's a context, create a collection on that context first, and select // nodes from there else if (context !== undefined) return $(context).find(selector) // If it's a CSS selector, use it to select nodes. else dom = zepto.qsa(document, selector) } // If a function is given, call it when the DOM is ready else if (isFunction(selector)) return $(document).ready(selector) // If a Zepto collection is given, just return it else if (zepto.isZ(selector)) return selector else { // normalize array if an array of nodes is given if (isArray(selector)) dom = compact(selector) // Wrap DOM nodes. else if (isObject(selector))
推荐阅读
智慧城市发展路径应分级分类
智能泊车、长途智能抄表、智能路灯杆、智能井盖……聪明城市扶植正在为我们的生活带来各类便利。聪明城市也成为当前热议的话题。6月8日,第二十届中国北京国际科技家当博览会同>>>详细阅读
本文标题:JavaScript的API设计原则
地址:http://www.17bianji.com/lsqh/35828.html
1/2 1