shinpei 最近的时间轴更新
shinpei

shinpei

V2EX 第 426879 号会员,加入于 2019-07-04 18:06:35 +08:00
shinpei 最近回复了
2021-03-10 13:06:42 +08:00
回复了 shinpei 创建的主题 酷工作 [网易·杭州]招聘高级/资深/专家前端工程师
另外也招其他的工程师:
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 ) {...}
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   990 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 15ms · UTC 22:43 · PVG 06:43 · LAX 15:43 · JFK 18:43
Developed with CodeLauncher
♥ Do have faith in what you're doing.