1

jsHint 使用我传入参数的标准模块模式在自调用函数的末尾生成错误:}(window.document, jQuery))

有谁知道为什么?

var kaApp = (function (document, $) {
  'use strict';
    var testStrict = {p1:10, p2:15, p3:20};
    // x = 3;
    var docElem = document.documentElement;
    console.log(testStrict);
    if(foo === undefined){
        var foo = 'foobar';
    }
    var setUserAgentString = function userAgent() {
        docElem.setAttribute('data-useragent', navigator.userAgent);
    };

    console.log('userAgentInit name: ' + setUserAgentString.name);

    return {
        init: function() {
            setUserAgentString();
            $(document).ready(this.afterDomReady);
        },
        afterDomReady: function() { 
            // Executes after DOM ready
            console.log('----- DOM is ready!!!!');
        }
    };

}(window.document, jQuery)); // error here "missing 'use strict' statement"

kaApp.init(document, jQuery);
4

0 回答 0