Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Fenkart <hnrch02@gmail.com>2014-10-23 08:15:36 +0400
committerHeinrich Fenkart <hnrch02@gmail.com>2014-10-23 08:15:36 +0400
commit9814256736fce32674c55a792b3b56185f50d47c (patch)
treed4f954195d030701b18fdaccd65c9f18034dc98d
parentfe511484343064a344d64cfedd5b10bfb2409823 (diff)
parent1604af041b238c90d52f851c7601204e25fca2be (diff)
Merge pull request #14852 from twbs/jquery-version-check
Add jQuery version check to existing jQuery presence check
-rw-r--r--Gruntfile.js19
-rw-r--r--bower.json2
-rw-r--r--docs/assets/js/src/customizer.js16
3 files changed, 31 insertions, 6 deletions
diff --git a/Gruntfile.js b/Gruntfile.js
index e945b9d480..0e5627d9ec 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -37,8 +37,21 @@ module.exports = function (grunt) {
' * Copyright 2011-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
' * Licensed under <%= pkg.license.type %> (<%= pkg.license.url %>)\n' +
' */\n',
- // NOTE: This jqueryCheck code is duplicated in customizer.js; if making changes here, be sure to update the other copy too.
- jqueryCheck: 'if (typeof jQuery === \'undefined\') { throw new Error(\'Bootstrap\\\'s JavaScript requires jQuery\') }\n\n',
+ // NOTE: This jqueryCheck/jqueryVersionCheck code is duplicated in customizer.js;
+ // if making changes here, be sure to update the other copy too.
+ jqueryCheck: [
+ 'if (typeof jQuery === \'undefined\') {',
+ ' throw new Error(\'Bootstrap\\\'s JavaScript requires jQuery\')',
+ '}\n'
+ ].join('\n'),
+ jqueryVersionCheck: [
+ '+function ($) {',
+ ' var version = $.fn.jquery.split(\' \')[0].split(\'.\')',
+ ' if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1)) {',
+ ' throw new Error(\'Bootstrap\\\'s JavaScript requires jQuery version 1.9.1 or higher\')',
+ ' }',
+ '}(jQuery);\n\n'
+ ].join('\n'),
// Task configuration.
clean: {
@@ -93,7 +106,7 @@ module.exports = function (grunt) {
concat: {
options: {
- banner: '<%= banner %>\n<%= jqueryCheck %>',
+ banner: '<%= banner %>\n<%= jqueryCheck %>\n<%= jqueryVersionCheck %>',
stripBanners: false
},
bootstrap: {
diff --git a/bower.json b/bower.json
index 24603e6b69..8ede249259 100644
--- a/bower.json
+++ b/bower.json
@@ -33,6 +33,6 @@
"test-infra"
],
"dependencies": {
- "jquery": ">= 1.9.0"
+ "jquery": ">= 1.9.1"
}
}
diff --git a/docs/assets/js/src/customizer.js b/docs/assets/js/src/customizer.js
index 3af093c9ae..c1c7d7971e 100644
--- a/docs/assets/js/src/customizer.js
+++ b/docs/assets/js/src/customizer.js
@@ -319,7 +319,19 @@ window.onload = function () { // wait for load in a dumb way because B-0
function generateJS(preamble) {
var $checked = $('#plugin-section input:checked')
- var jqueryCheck = 'if (typeof jQuery === "undefined") { throw new Error("Bootstrap\'s JavaScript requires jQuery") }\n\n'
+ var jqueryCheck = [
+ 'if (typeof jQuery === \'undefined\') {',
+ ' throw new Error(\'Bootstrap\\\'s JavaScript requires jQuery\')',
+ '}\n'
+ ].join('\n')
+ var jqueryVersionCheck = [
+ '+function ($) {',
+ ' var version = $.fn.jquery.split(\' \')[0].split(\'.\')',
+ ' if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1)) {',
+ ' throw new Error(\'Bootstrap\\\'s JavaScript requires jQuery version 1.9.1 or higher\')',
+ ' }',
+ '}(jQuery);\n\n'
+ ].join('\n')
if (!$checked.length) return false
@@ -329,7 +341,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
.join('\n')
preamble = cw + preamble
- js = jqueryCheck + js
+ js = jqueryCheck + jqueryVersionCheck + js
return {
'bootstrap.js': preamble + js,