0

jQueryラッパー コードを使用する基本的なスクリプトがあり、転送されたグローバルwindowパラメータで初期化されます。このパラメータを転送する必要がありますか? windowはグローバルパラメーターであり、転送するかどうかにかかわらず、関数内から使用できます。

その理由は何ですか?

(function (window, undefined) {
    var jQuery = (function () {

        //Define a local copy of jQuery
        var jQuery = function (selector, context) {
            // The jQuery object is actually just the init constructor 'enhanced'
            return new jQuery.fn.init(selector, context, rootjQuery);
        },  
    //some code
    //...
    //...
    //...

    window.jQuery = window.$ = jQuery;
})(window);
4

1 に答える 1