diff options
| author | Johann-S <[email protected]> | 2017-09-03 12:56:04 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-09-03 12:56:04 +0200 |
| commit | e04e42d08c059732153ff6925fa712464cf12207 (patch) | |
| tree | a4c5d188bf8416fe7b801fbac79a2ad21af7012e /js/src | |
| parent | 45baa15932dd9c546c4618acca0b02d6f661e657 (diff) | |
| parent | 2e5f1e22860a892f5abdbb65abc14172e0129c1a (diff) | |
| download | bootstrap-e04e42d08c059732153ff6925fa712464cf12207.tar.xz bootstrap-e04e42d08c059732153ff6925fa712464cf12207.zip | |
Merge branch 'v4-dev' into fix-jumping-modal-on-resize
Diffstat (limited to 'js/src')
| -rw-r--r-- | js/src/alert.js | 3 | ||||
| -rw-r--r-- | js/src/button.js | 3 | ||||
| -rw-r--r-- | js/src/carousel.js | 3 | ||||
| -rw-r--r-- | js/src/collapse.js | 3 | ||||
| -rw-r--r-- | js/src/dropdown.js | 8 | ||||
| -rw-r--r-- | js/src/index.js | 46 | ||||
| -rw-r--r-- | js/src/modal.js | 6 | ||||
| -rw-r--r-- | js/src/popover.js | 3 | ||||
| -rw-r--r-- | js/src/scrollspy.js | 3 | ||||
| -rw-r--r-- | js/src/tab.js | 3 | ||||
| -rw-r--r-- | js/src/tooltip.js | 8 | ||||
| -rw-r--r-- | js/src/util.js | 4 |
12 files changed, 75 insertions, 18 deletions
diff --git a/js/src/alert.js b/js/src/alert.js index b6b9336af..9fcf088b1 100644 --- a/js/src/alert.js +++ b/js/src/alert.js @@ -1,3 +1,4 @@ +import $ from 'jquery' import Util from './util' @@ -8,7 +9,7 @@ import Util from './util' * -------------------------------------------------------------------------- */ -const Alert = (($) => { +const Alert = (() => { /** diff --git a/js/src/button.js b/js/src/button.js index a8a72ef56..a121b8e13 100644 --- a/js/src/button.js +++ b/js/src/button.js @@ -1,3 +1,4 @@ +import $ from 'jquery' /** * -------------------------------------------------------------------------- * Bootstrap (v4.0.0-beta): button.js @@ -5,7 +6,7 @@ * -------------------------------------------------------------------------- */ -const Button = (($) => { +const Button = (() => { /** diff --git a/js/src/carousel.js b/js/src/carousel.js index 873660519..a5ad02541 100644 --- a/js/src/carousel.js +++ b/js/src/carousel.js @@ -1,3 +1,4 @@ +import $ from 'jquery' import Util from './util' @@ -8,7 +9,7 @@ import Util from './util' * -------------------------------------------------------------------------- */ -const Carousel = (($) => { +const Carousel = (() => { /** diff --git a/js/src/collapse.js b/js/src/collapse.js index 7d1ba4c54..acc959d40 100644 --- a/js/src/collapse.js +++ b/js/src/collapse.js @@ -1,3 +1,4 @@ +import $ from 'jquery' import Util from './util' @@ -8,7 +9,7 @@ import Util from './util' * -------------------------------------------------------------------------- */ -const Collapse = (($) => { +const Collapse = (() => { /** diff --git a/js/src/dropdown.js b/js/src/dropdown.js index e1c48ac6e..adb54f0f2 100644 --- a/js/src/dropdown.js +++ b/js/src/dropdown.js @@ -1,5 +1,5 @@ -/* global Popper */ - +import $ from 'jquery' +import Popper from 'popper.js' import Util from './util' @@ -10,7 +10,7 @@ import Util from './util' * -------------------------------------------------------------------------- */ -const Dropdown = (($) => { +const Dropdown = (() => { /** * Check for Popper dependency @@ -445,6 +445,6 @@ const Dropdown = (($) => { return Dropdown -})(jQuery) +})(jQuery, Popper) export default Dropdown diff --git a/js/src/index.js b/js/src/index.js new file mode 100644 index 000000000..84a27880e --- /dev/null +++ b/js/src/index.js @@ -0,0 +1,46 @@ +import $ from 'jquery' +import Alert from './alert' +import Button from './button' +import Carousel from './carousel' +import Collapse from './collapse' +import Dropdown from './dropdown' +import Modal from './modal' +import Popover from './popover' +import Scrollspy from './scrollspy' +import Tab from './tab' +import Tooltip from './tooltip' +import Util from './util' + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v4.0.0-alpha.6): index.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * -------------------------------------------------------------------------- + */ + +(() => { + if (typeof jQuery === 'undefined') { + throw new Error('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.') + } + + const version = $.fn.jquery.split(' ')[0].split('.') + const min = 3 + const max = 4 + if (version[0] < min || version[0] >= max) { + throw new Error('Bootstrap\'s JavaScript requires at least jQuery v3.0.0 but less than v4.0.0') + } +})(jQuery) + +export { + Util, + Alert, + Button, + Carousel, + Collapse, + Dropdown, + Modal, + Popover, + Scrollspy, + Tab, + Tooltip +} diff --git a/js/src/modal.js b/js/src/modal.js index 5892ed045..689e93bc1 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -1,3 +1,4 @@ +import $ from 'jquery' import Util from './util' @@ -8,7 +9,7 @@ import Util from './util' * -------------------------------------------------------------------------- */ -const Modal = (($) => { +const Modal = (() => { /** @@ -428,7 +429,8 @@ const Modal = (($) => { } _checkScrollbar() { - this._isBodyOverflowing = document.body.clientWidth < window.innerWidth + const rect = document.body.getBoundingClientRect() + this._isBodyOverflowing = rect.left + rect.right < window.innerWidth this._scrollbarWidth = this._getScrollbarWidth() } diff --git a/js/src/popover.js b/js/src/popover.js index f5820ecbe..aeccdf750 100644 --- a/js/src/popover.js +++ b/js/src/popover.js @@ -1,3 +1,4 @@ +import $ from 'jquery' import Tooltip from './tooltip' @@ -8,7 +9,7 @@ import Tooltip from './tooltip' * -------------------------------------------------------------------------- */ -const Popover = (($) => { +const Popover = (() => { /** diff --git a/js/src/scrollspy.js b/js/src/scrollspy.js index 588f65298..70067c0b3 100644 --- a/js/src/scrollspy.js +++ b/js/src/scrollspy.js @@ -1,3 +1,4 @@ +import $ from 'jquery' import Util from './util' @@ -8,7 +9,7 @@ import Util from './util' * -------------------------------------------------------------------------- */ -const ScrollSpy = (($) => { +const ScrollSpy = (() => { /** diff --git a/js/src/tab.js b/js/src/tab.js index c32cd3776..18af4e7e2 100644 --- a/js/src/tab.js +++ b/js/src/tab.js @@ -1,3 +1,4 @@ +import $ from 'jquery' import Util from './util' @@ -8,7 +9,7 @@ import Util from './util' * -------------------------------------------------------------------------- */ -const Tab = (($) => { +const Tab = (() => { /** diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 37573cf49..5dc28ab7e 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -1,5 +1,5 @@ -/* global Popper */ - +import $ from 'jquery' +import Popper from 'popper.js' import Util from './util' @@ -10,7 +10,7 @@ import Util from './util' * -------------------------------------------------------------------------- */ -const Tooltip = (($) => { +const Tooltip = (() => { /** * Check for Popper dependency @@ -728,6 +728,6 @@ const Tooltip = (($) => { return Tooltip -})(jQuery) +})(jQuery, Popper) export default Tooltip diff --git a/js/src/util.js b/js/src/util.js index cd3f1fb6a..b18d0f776 100644 --- a/js/src/util.js +++ b/js/src/util.js @@ -1,3 +1,5 @@ +import $ from 'jquery' + /** * -------------------------------------------------------------------------- * Bootstrap (v4.0.0-beta): util.js @@ -5,7 +7,7 @@ * -------------------------------------------------------------------------- */ -const Util = (($) => { +const Util = (() => { /** |
