diff options
author | Johann-S <johann.servoire@gmail.com> | 2019-03-01 16:52:43 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2019-03-08 01:30:24 +0300 |
commit | 86de1d3875d50fdea6fac0a5353a8da3804366ba (patch) | |
tree | 71abf1b4aa6076ef4a384c68a001c271e52d81ad /js/src | |
parent | dad0765ed3cbd903b6b56330c7fc65d855de0339 (diff) |
fix jquery detection
Diffstat (limited to 'js/src')
-rw-r--r-- | js/src/index.js | 18 | ||||
-rw-r--r-- | js/src/util.js | 18 |
2 files changed, 18 insertions, 18 deletions
diff --git a/js/src/index.js b/js/src/index.js index c4a4d4b1f4..327de242b2 100644 --- a/js/src/index.js +++ b/js/src/index.js @@ -1,4 +1,3 @@ -import $ from 'jquery' import Alert from './alert' import Button from './button' import Carousel from './carousel' @@ -19,23 +18,6 @@ import Util from './util' * -------------------------------------------------------------------------- */ -(() => { - if (typeof $ === 'undefined') { - throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.') - } - - const version = $.fn.jquery.split(' ')[0].split('.') - const minMajor = 1 - const ltMajor = 2 - const minMinor = 9 - const minPatch = 1 - const maxMajor = 4 - - if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) { - throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0') - } -})() - export { Util, Alert, diff --git a/js/src/util.js b/js/src/util.js index d459aa266b..43121b4c9e 100644 --- a/js/src/util.js +++ b/js/src/util.js @@ -169,9 +169,27 @@ const Util = { } return Util.findShadowRoot(element.parentNode) + }, + + jQueryDetection() { + if (typeof $ === 'undefined') { + throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.') + } + + const version = $.fn.jquery.split(' ')[0].split('.') + const minMajor = 1 + const ltMajor = 2 + const minMinor = 9 + const minPatch = 1 + const maxMajor = 4 + + if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) { + throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0') + } } } +Util.jQueryDetection() setTransitionEndSupport() export default Util |