diff options
| author | lucascono <[email protected]> | 2017-10-04 05:33:17 -0300 |
|---|---|---|
| committer | lucascono <[email protected]> | 2017-10-04 05:33:17 -0300 |
| commit | 8c04a74c8c7f0174ea08bc02fa3762f49bf615a3 (patch) | |
| tree | db9d6923c082243d765c57885992db8dd26a70b5 /js/src/tooltip.js | |
| parent | 9aff890efa3798f831b714c41794c9fee0684bae (diff) | |
| parent | b29b1e155880ac953899889c9cbb67f7f7df0529 (diff) | |
| download | bootstrap-8c04a74c8c7f0174ea08bc02fa3762f49bf615a3.tar.xz bootstrap-8c04a74c8c7f0174ea08bc02fa3762f49bf615a3.zip | |
Merge remote-tracking branch 'refs/remotes/twbs/v4-dev' into v4-dev
Diffstat (limited to 'js/src/tooltip.js')
| -rw-r--r-- | js/src/tooltip.js | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/js/src/tooltip.js b/js/src/tooltip.js index c7c7b9f9d..8d262f4ad 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -1,16 +1,16 @@ -/* global Popper */ - +import $ from 'jquery' +import Popper from 'popper.js' import Util from './util' /** * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-alpha.6): tooltip.js + * Bootstrap (v4.0.0-beta): tooltip.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ -const Tooltip = (($) => { +const Tooltip = (() => { /** * Check for Popper dependency @@ -28,7 +28,7 @@ const Tooltip = (($) => { */ const NAME = 'tooltip' - const VERSION = '4.0.0-alpha.6' + const VERSION = '4.0.0-beta' const DATA_KEY = 'bs.tooltip' const EVENT_KEY = `.${DATA_KEY}` const JQUERY_NO_CONFLICT = $.fn[NAME] @@ -184,6 +184,10 @@ const Tooltip = (($) => { } toggle(event) { + if (!this._isEnabled) { + return + } + if (event) { const dataKey = this.constructor.DATA_KEY let context = $(event.currentTarget).data(dataKey) @@ -234,8 +238,8 @@ const Tooltip = (($) => { if (this._popper !== null) { this._popper.destroy() } - this._popper = null + this._popper = null this.element = null this.config = null this.tip = null @@ -415,7 +419,8 @@ const Tooltip = (($) => { } getTipElement() { - return this.tip = this.tip || $(this.config.template)[0] + this.tip = this.tip || $(this.config.template)[0] + return this.tip } setContent() { @@ -617,18 +622,18 @@ const Tooltip = (($) => { config ) - if (config.delay && typeof config.delay === 'number') { + if (typeof config.delay === 'number') { config.delay = { show : config.delay, hide : config.delay } } - if (config.title && typeof config.title === 'number') { + if (typeof config.title === 'number') { config.title = config.title.toString() } - if (config.content && typeof config.content === 'number') { + if (typeof config.content === 'number') { config.content = config.content.toString() } @@ -698,14 +703,13 @@ const Tooltip = (($) => { } if (typeof config === 'string') { - if (data[config] === undefined) { + if (typeof data[config] === 'undefined') { throw new Error(`No method named "${config}"`) } data[config]() } }) } - } @@ -724,6 +728,6 @@ const Tooltip = (($) => { return Tooltip -})(jQuery) +})($, Popper) export default Tooltip |
