this === null) throw new TypeError()
var t = Object(this),
len = t.length >>> 0,
k = 0,
accumulator
if (typeof fun != 'function') throw new TypeError()
if (len == 0 && arguments.length == 1) throw new TypeError()
//取初始值
if (arguments.length >= 2) accumulator = arguments[1] //如果参数长度大于2个,则将第二个参数作为初始值
else do {
if (k in t) {
accumulator = t[k++] //否则将数组的第一条数据作为初绍值
break
}
if (++k >= len) throw new TypeError() //什么情况下会执行到这里来???
} while (true)
//遍历数组,将前一次的结果传入处理函数进行累计处理
while (k < len) {
if (k in t) accumulator = fun.call(undefined, accumulator, t[k], k, t)
k++
}
return accumulator
}
})()
var Zepto = (function() {
var undefined, key, $, classList, emptyArray = [],
slice = emptyArray.slice,
filter = emptyArray.filter,
document = window.document,
elementDisplay = {}, classCache = {},
getComputedStyle = document.defaultView.getComputedStyle,
//设置CSS时,不用加px单位的属性
cssNumber = {
'column-count': 1,
'columns': 1,
'font-weight': 1,
'line-height': 1,
'opacity': 1,
'z-index': 1,
'zoom': 1
},
//HTML代码片断的正则
fragmentRE = /^\s*<(\w+
关键词:zepto是啥