Skip to content

Commit 1c42dfc

Browse files
committed
Merge pull request #13842 from twbs/fix-13811
update "is jQuery defined" check for UMD compatibility
2 parents 4f95989 + f347d7d commit 1c42dfc

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module.exports = function (grunt) {
3333
' * Licensed under <%= pkg.license.type %> (<%= pkg.license.url %>)\n' +
3434
' */\n',
3535
// NOTE: This jqueryCheck code is duplicated in customizer.js; if making changes here, be sure to update the other copy too.
36-
jqueryCheck: 'if (typeof jQuery === \'undefined\') { throw new Error(\'Bootstrap\\\'s JavaScript requires jQuery\') }\n\n',
36+
jqueryCheck: 'if (typeof define == \'undefined\' && typeof exports == \'undefined\' && typeof jQuery == \'undefined\') { throw new Error(\'Bootstrap\\\'s JavaScript requires jQuery\') }\n\n',
3737

3838
// Task configuration.
3939
clean: {

dist/js/bootstrap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
55
*/
66

7-
if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript requires jQuery') }
7+
if (typeof define == 'undefined' && typeof exports == 'undefined' && typeof jQuery == 'undefined') { throw new Error('Bootstrap\'s JavaScript requires jQuery') }
88

99
/* ========================================================================
1010
* Bootstrap: transition.js v3.1.1

docs/assets/js/_src/customizer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
306306

307307
function generateJS(preamble) {
308308
var $checked = $('#plugin-section input:checked')
309-
var jqueryCheck = 'if (typeof jQuery === "undefined") { throw new Error("Bootstrap\'s JavaScript requires jQuery") }\n\n'
309+
var jqueryCheck = 'if (typeof define == \'undefined\' && typeof exports == \'undefined\' && typeof jQuery == \'undefined\') { throw new Error(\'Bootstrap\\\'s JavaScript requires jQuery\') }\n\n'
310310

311311
if (!$checked.length) return false
312312

0 commit comments

Comments
 (0)