V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
kevinroot
V2EX  ›  问与答

zeptojs 为毛最后不给加个分号

  •  
  •   kevinroot · 2014-05-08 10:18:54 +08:00 · 2726 次点击
    这是一个创建于 3641 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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';
    8 条回复    2014-05-08 11:00:18 +08:00
    likang
        1
    likang  
       2014-05-08 10:35:32 +08:00
    combo 的时候统一加换行符呢?
    kevinroot
        2
    kevinroot  
    OP
       2014-05-08 10:38:57 +08:00
    @likang 这样应该是可以的,不过现在combo没有加换行的机制
    zythum
        3
    zythum  
       2014-05-08 10:39:08 +08:00
    你拿压缩混淆的版本不就可以了...
    kevinroot
        4
    kevinroot  
    OP
       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
        5
    jsonline  
       2014-05-08 10:41:45 +08:00
    你也要在最开头加分号
    kevinroot
        6
    kevinroot  
    OP
       2014-05-08 10:44:00 +08:00
    @jsonline 这不符合我们的编码规范 - -!
    jsonline
        7
    jsonline  
       2014-05-08 10:44:53 +08:00
    @kevinroot combo 在连接的时候每个文件之间加分号
    zzNucker
        8
    zzNucker  
       2014-05-08 11:00:18 +08:00
    @kevinroot 本来就是在开头加分号比较多吧 - -
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5420 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 08:46 · PVG 16:46 · LAX 01:46 · JFK 04:46
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.