zeptojs 为毛最后不给加个分号

2014-05-08 10:18:54 +08:00
 kevinroot
http://zeptojs.com/zepto.js
他的规范貌似是分号写在开头,这样我combo js的时候就报错了
;(function($){
// __proto__ doesn't exist on IE<11, so redefine
// the Z function to use object extension instead
if (!('__proto__' in {})) {
$.extend($.zepto, {
Z: function(dom, selector){
dom = dom || []
$.extend(dom, $.fn)
dom.selector = selector || ''
dom.__Z = true
return dom
},
// this is a kludge but works
isZ: function(object){
return $.type(object) === 'array' && '__Z' in object
}
})
}

// getComputedStyle shouldn't freak out when called
// without a valid element as argument
try {
getComputedStyle(undefined)
} catch(e) {
var nativeGetComputedStyle = getComputedStyle;
window.getComputedStyle = function(element){
try {
return nativeGetComputedStyle(element)
} catch(e) {
return null
}
}
}
})(Zepto)var myvar = 'test';
2759 次点击
所在节点    问与答
8 条回复
likang
2014-05-08 10:35:32 +08:00
combo 的时候统一加换行符呢?
kevinroot
2014-05-08 10:38:57 +08:00
@likang 这样应该是可以的,不过现在combo没有加换行的机制
zythum
2014-05-08 10:39:08 +08:00
你拿压缩混淆的版本不就可以了...
kevinroot
2014-05-08 10:41:42 +08:00
@zythum 他最新版的可以
http://zeptojs.com/zepto.min.js
我们的版本是压缩的还是不行
http://s.thsi.cn/js/m/js/zepto.min.js
jsonline
2014-05-08 10:41:45 +08:00
你也要在最开头加分号
kevinroot
2014-05-08 10:44:00 +08:00
@jsonline 这不符合我们的编码规范 - -!
jsonline
2014-05-08 10:44:53 +08:00
@kevinroot combo 在连接的时候每个文件之间加分号
zzNucker
2014-05-08 11:00:18 +08:00
@kevinroot 本来就是在开头加分号比较多吧 - -

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/111591

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX