mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 10:27:49 +00:00
Avoid chance fails by noConflict race conditions.
This commit is contained in:
@@ -115,12 +115,6 @@
|
|||||||
delete Object._keys;
|
delete Object._keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Avoid a bug in IE compat mode where, under certain
|
|
||||||
// circumstances, timer API like `setTimeout` may not
|
|
||||||
// be the same reference as `window.setTimeout`.
|
|
||||||
window.clearTimeout = window.clearTimeout;
|
|
||||||
window.setTimeout = window.setTimeout;
|
|
||||||
|
|
||||||
addBizarroMethods();
|
addBizarroMethods();
|
||||||
|
|
||||||
// load Lo-Dash and expose it to the bad extensions/shims
|
// load Lo-Dash and expose it to the bad extensions/shims
|
||||||
@@ -209,6 +203,8 @@
|
|||||||
|
|
||||||
function loadModulesAndTests() {
|
function loadModulesAndTests() {
|
||||||
require(getConfig(), ['lodash', 'shimmed', 'underscore'], function(lodash, shimmed, underscore) {
|
require(getConfig(), ['lodash', 'shimmed', 'underscore'], function(lodash, shimmed, underscore) {
|
||||||
|
var oldDash = window._;
|
||||||
|
|
||||||
if (shimmed && shimmed.noConflict) {
|
if (shimmed && shimmed.noConflict) {
|
||||||
shimmedModule = shimmed.noConflict();
|
shimmedModule = shimmed.noConflict();
|
||||||
shimmedModule.moduleName = 'shimmed';
|
shimmedModule.moduleName = 'shimmed';
|
||||||
@@ -221,7 +217,7 @@
|
|||||||
lodashModule = lodash;
|
lodashModule = lodash;
|
||||||
lodashModule.moduleName = 'lodash';
|
lodashModule.moduleName = 'lodash';
|
||||||
}
|
}
|
||||||
if (ui.isModularize) {
|
if (oldDash || ui.isModularize) {
|
||||||
window._ = lodash;
|
window._ = lodash;
|
||||||
}
|
}
|
||||||
require(['test'], function() {
|
require(['test'], function() {
|
||||||
|
|||||||
@@ -8704,7 +8704,7 @@
|
|||||||
|
|
||||||
test('should accept falsey arguments', 157, function() {
|
test('should accept falsey arguments', 157, function() {
|
||||||
var emptyArrays = _.map(falsey, function() { return []; }),
|
var emptyArrays = _.map(falsey, function() { return []; }),
|
||||||
isExported = '_' in root,
|
isExposed = '_' in root,
|
||||||
oldDash = root._;
|
oldDash = root._;
|
||||||
|
|
||||||
_.forEach(acceptFalsey, function(methodName) {
|
_.forEach(acceptFalsey, function(methodName) {
|
||||||
@@ -8721,7 +8721,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (methodName == 'noConflict') {
|
if (methodName == 'noConflict') {
|
||||||
if (isExported) {
|
if (isExposed) {
|
||||||
root._ = oldDash;
|
root._ = oldDash;
|
||||||
} else {
|
} else {
|
||||||
delete root._;
|
delete root._;
|
||||||
|
|||||||
Reference in New Issue
Block a user