mirror of
https://github.com/Modernizr/Modernizr.git
synced 2026-01-09 15:47:55 -05:00
* fix issue #2520 - set scriptGlobalName causing an exception * fix tests Co-authored-by: tomer <tomer@securedtouch.com>
This commit is contained in:
@@ -23,8 +23,8 @@ var baseRequireConfig = {
|
||||
include: ['modernizr-init'],
|
||||
fileExclusionRegExp: /^(.git|node_modules|modulizr|media|test)$/,
|
||||
wrap: {
|
||||
start: '\n;(function(window, document, undefined){',
|
||||
end: '})(window, document);'
|
||||
start: '\n;(function(scriptGlobalObject, window, document, undefined){',
|
||||
end: '})(window, window, document);'
|
||||
},
|
||||
onBuildWrite: function(id, path, contents) {
|
||||
if (this.optimize === 'uglify') {
|
||||
@@ -83,7 +83,7 @@ function build(generate, generateBanner, pkg) {
|
||||
}
|
||||
|
||||
if(config.scriptGlobalName) {
|
||||
requireConfig.wrap.end = '})(' + config.scriptGlobalName + ', document);';
|
||||
requireConfig.wrap.end = '})(' + config.scriptGlobalName + ', window, document);';
|
||||
}
|
||||
|
||||
requireConfig.out = function(output) {
|
||||
|
||||
@@ -76,7 +76,7 @@ define(['lodash'], function(_) {
|
||||
' }\n\n';
|
||||
|
||||
output += ' // Leak Modernizr namespace\n' +
|
||||
' window.Modernizr = Modernizr;\n' +
|
||||
' scriptGlobalObject.Modernizr = Modernizr;\n' +
|
||||
'\n' +
|
||||
'});';
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ describe('cli/build', function() {
|
||||
'feature-detects': ['css/boxsizing']
|
||||
};
|
||||
build(config, function(file) {
|
||||
expect(file).to.contain('})(window, document);');
|
||||
expect(file).to.contain('})(window, window, document);');
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -132,7 +132,7 @@ describe('cli/build', function() {
|
||||
'feature-detects': ['css/boxsizing']
|
||||
};
|
||||
build(config, function(file) {
|
||||
expect(file).to.contain('})(window.awesomeco, document);');
|
||||
expect(file).to.contain('})(window.awesomeco, window, document);');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user