Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bootstrap
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
bootstrap
Commits
1604af04
Commit
1604af04
authored
Oct 22, 2014
by
Heinrich Fenkart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add jQuery version check to existing jQuery presence check
Fixes #14809. Closes #14825.
parent
57e4b587
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
6 deletions
+31
-6
Gruntfile.js
Gruntfile.js
+16
-3
bower.json
bower.json
+1
-1
docs/assets/js/src/customizer.js
docs/assets/js/src/customizer.js
+14
-2
No files found.
Gruntfile.js
View file @
1604af04
...
...
@@ -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
:
{
...
...
bower.json
View file @
1604af04
...
...
@@ -33,6 +33,6 @@
"test-infra"
],
"dependencies"
:
{
"jquery"
:
">= 1.9.
0
"
"jquery"
:
">= 1.9.
1
"
}
}
docs/assets/js/src/customizer.js
View file @
1604af04
...
...
@@ -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
+
j
queryVersionCheck
+
j
s
return
{
'
bootstrap.js
'
:
preamble
+
js
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment