shinpei's recent timeline updates
shinpei

shinpei

V2EX member #426879, joined on 2019-07-04 18:06:35 +08:00
shinpei's recent replies
另外也招其他的工程师:
Java 开发工程师、
平台算法工程师、
NLP 算法工程师、
测试开发工程师都可以到碗里来
@hgjian 不客气
@hgjian 我的意思是把
if ( !noGlobal ) {
window.jQuery = window.$ = jQuery;
}
直接写成
window.jQuery = window.$ = jQuery;
简单点就是你去修改下 jquery 源码,把 if (!noGlobal) 判断去掉
这个就涉及到 jQuery 源码的问题了;

jquery 在代码尾部全局注册:
if ( !noGlobal ) {
window.jQuery = window.$ = jQuery;
}


// 这个是开始的代码,由于这个网站 module 是存在的,所以 noGlobal 为 true,
( function( global, factory ) {

"use strict";

if ( typeof module === "object" && typeof module.exports === "object" ) {

// For CommonJS and CommonJS-like environments where a proper `window`
// is present, execute the factory and get jQuery.
// For environments that do not have a `window` with a `document`
// (such as Node.js), expose a factory as module.exports.
// This accentuates the need for the creation of a real `window`.
// e.g. var jQuery = require("jquery")(window);
// See ticket #14549 for more info.
module.exports = global.document ?
factory( global, true ) :
function( w ) {
if ( !w.document ) {
throw new Error( "jQuery requires a window with a document" );
}
return factory( w );
};
} else {
factory( global );
}

// Pass this if window is not defined yet
} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {...}
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2815 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 14ms · UTC 06:29 · PVG 14:29 · LAX 23:29 · JFK 02:29
♥ Do have faith in what you're doing.