From 2ae5fdf9ddbff98c55e47b81d7150b8d960ad342 Mon Sep 17 00:00:00 2001 From: Bernardo Gurgel Filho Date: Sun, 23 Aug 2015 01:59:48 -0300 Subject: Convert tooltip's arrows to generated CSS content via :before --- js/src/tooltip.js | 1 - 1 file changed, 1 deletion(-) (limited to 'js/src/tooltip.js') diff --git a/js/src/tooltip.js b/js/src/tooltip.js index aa5c73945..099a47482 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -28,7 +28,6 @@ const Tooltip = (($) => { const Default = { animation : true, template : '', trigger : 'hover focus', title : '', -- cgit v1.2.3 From 6d451ad99d02ed60ced937901a9d8b8323999af3 Mon Sep 17 00:00:00 2001 From: Johann-S Date: Wed, 16 Sep 2015 09:46:55 +0200 Subject: Change destroy -> dispose --- js/src/tooltip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/src/tooltip.js') diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 151cd6f51..55b9d5898 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -612,7 +612,7 @@ const Tooltip = (($) => { let _config = typeof config === 'object' ? config : null - if (!data && /destroy|hide/.test(config)) { + if (!data && /dispose|hide/.test(config)) { return } -- cgit v1.2.3 From 1a23279237b5360dab15d91aac85cbf8306e560a Mon Sep 17 00:00:00 2001 From: "Michael J. Ryan" Date: Mon, 14 Mar 2016 13:18:08 -0700 Subject: Update tooltip.js Don't reference `Tether` via attachment to `window`, with the update one can import bootstrap providing the dependencies in webpack with: ``` new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery', Tether: 'tether', }); ``` Then inside one's own bootstrap/globals, `import 'bootstrap';` will simply work, and $/jQuery can be used from there. I had wanted to do this, but also expose jQuery, Tether, etc when in development build in my code, but if I provide `window.Tether`, I can't then expose it to the outside... --- js/src/tooltip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/src/tooltip.js') diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 77803dc40..03d9e4cc8 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -16,7 +16,7 @@ const Tooltip = (($) => { * Check for Tether dependency * Tether - http://github.hubspot.com/tether/ */ - if (window.Tether === undefined) { + if ('undefined' === typeof Tether) { throw new Error('Bootstrap tooltips require Tether (http://github.hubspot.com/tether/)') } -- cgit v1.2.3 From 681d390a0504c7a1c855a6eb052ea70409e41cde Mon Sep 17 00:00:00 2001 From: "Michael J. Ryan" Date: Mon, 14 Mar 2016 13:29:03 -0700 Subject: Update tooltip.js match project's style check --- js/src/tooltip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/src/tooltip.js') diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 03d9e4cc8..b98a56134 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -16,7 +16,7 @@ const Tooltip = (($) => { * Check for Tether dependency * Tether - http://github.hubspot.com/tether/ */ - if ('undefined' === typeof Tether) { + if (typeof Tether === 'undefined') { throw new Error('Bootstrap tooltips require Tether (http://github.hubspot.com/tether/)') } -- cgit v1.2.3 From 4f520c7ff301ce42f01e32bd77606ce94384cd13 Mon Sep 17 00:00:00 2001 From: J2TeaM Date: Wed, 7 Sep 2016 10:09:54 +0700 Subject: Merge #20563 and #20567 --- js/src/tooltip.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'js/src/tooltip.js') diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 08daae2f2..e0691f14c 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -371,9 +371,7 @@ const Tooltip = (($) => { this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle()) - $tip - .removeClass(ClassName.FADE) - .removeClass(ClassName.IN) + $tip.removeClass(`${ClassName.FADE} ${ClassName.IN}`) this.cleanupTether() } -- cgit v1.2.3 From 2e69dfa8c1679238579ef6f5ec85deb755e4fb6d Mon Sep 17 00:00:00 2001 From: Bardi Harborow Date: Tue, 4 Oct 2016 02:55:59 +1000 Subject: Fix broken/redirected links, moving to HTTPS where possible. (#20557) --- js/src/tooltip.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/src/tooltip.js') diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 08daae2f2..d012b2907 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -14,10 +14,10 @@ const Tooltip = (($) => { /** * Check for Tether dependency - * Tether - http://github.hubspot.com/tether/ + * Tether - http://tether.io/ */ if (window.Tether === undefined) { - throw new Error('Bootstrap tooltips require Tether (http://github.hubspot.com/tether/)') + throw new Error('Bootstrap tooltips require Tether (http://tether.io/)') } -- cgit v1.2.3 From 8ff7edaab4f55b6612df3fe670aa9b9ac0984eae Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Wed, 19 Oct 2016 08:27:41 -0700 Subject: version bump to alpha 5 --- js/src/tooltip.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/src/tooltip.js') diff --git a/js/src/tooltip.js b/js/src/tooltip.js index e854b1bb4..c21eb0cda 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -5,7 +5,7 @@ import Util from './util' /** * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-alpha.4): tooltip.js + * Bootstrap (v4.0.0-alpha.5): tooltip.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ @@ -28,7 +28,7 @@ const Tooltip = (($) => { */ const NAME = 'tooltip' - const VERSION = '4.0.0-alpha.4' + const VERSION = '4.0.0-alpha.5' const DATA_KEY = 'bs.tooltip' const EVENT_KEY = `.${DATA_KEY}` const JQUERY_NO_CONFLICT = $.fn[NAME] -- cgit v1.2.3 From 9d129a43d6c24d9e60cc8fc7cfbddaaa4c586fdf Mon Sep 17 00:00:00 2001 From: Johann-S Date: Mon, 24 Oct 2016 10:57:32 +0200 Subject: Use a single class name for opened/expanded/shown state of widgets --- js/src/tooltip.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'js/src/tooltip.js') diff --git a/js/src/tooltip.js b/js/src/tooltip.js index c21eb0cda..90e782dc9 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -70,8 +70,8 @@ const Tooltip = (($) => { } const HoverState = { - IN : 'in', - OUT : 'out' + ACTIVE : 'active', + OUT : 'out' } const Event = { @@ -88,8 +88,8 @@ const Tooltip = (($) => { } const ClassName = { - FADE : 'fade', - IN : 'in' + FADE : 'fade', + ACTIVE : 'active' } const Selector = { @@ -205,7 +205,7 @@ const Tooltip = (($) => { } else { - if ($(this.getTipElement()).hasClass(ClassName.IN)) { + if ($(this.getTipElement()).hasClass(ClassName.ACTIVE)) { this._leave(null, this) return } @@ -291,7 +291,7 @@ const Tooltip = (($) => { Util.reflow(tip) this._tether.position() - $(tip).addClass(ClassName.IN) + $(tip).addClass(ClassName.ACTIVE) let complete = () => { let prevHoverState = this._hoverState @@ -319,7 +319,7 @@ const Tooltip = (($) => { let tip = this.getTipElement() let hideEvent = $.Event(this.constructor.Event.HIDE) let complete = () => { - if (this._hoverState !== HoverState.IN && tip.parentNode) { + if (this._hoverState !== HoverState.ACTIVE && tip.parentNode) { tip.parentNode.removeChild(tip) } @@ -338,7 +338,7 @@ const Tooltip = (($) => { return } - $(tip).removeClass(ClassName.IN) + $(tip).removeClass(ClassName.ACTIVE) if (Util.supportsTransitionEnd() && ($(this.tip).hasClass(ClassName.FADE))) { @@ -372,7 +372,7 @@ const Tooltip = (($) => { $tip .removeClass(ClassName.FADE) - .removeClass(ClassName.IN) + .removeClass(ClassName.ACTIVE) this.cleanupTether() } @@ -492,15 +492,15 @@ const Tooltip = (($) => { ] = true } - if ($(context.getTipElement()).hasClass(ClassName.IN) || - (context._hoverState === HoverState.IN)) { - context._hoverState = HoverState.IN + if ($(context.getTipElement()).hasClass(ClassName.ACTIVE) || + (context._hoverState === HoverState.ACTIVE)) { + context._hoverState = HoverState.ACTIVE return } clearTimeout(context._timeout) - context._hoverState = HoverState.IN + context._hoverState = HoverState.ACTIVE if (!context.config.delay || !context.config.delay.show) { context.show() @@ -508,7 +508,7 @@ const Tooltip = (($) => { } context._timeout = setTimeout(() => { - if (context._hoverState === HoverState.IN) { + if (context._hoverState === HoverState.ACTIVE) { context.show() } }, context.config.delay.show) -- cgit v1.2.3 From 0974267b8c2b137d563d36c2390b4491fb1e0309 Mon Sep 17 00:00:00 2001 From: Bardi Harborow Date: Tue, 1 Nov 2016 14:32:36 +1100 Subject: Move from $.proxy to es6 arrow functions. (#21049) --- js/src/tooltip.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'js/src/tooltip.js') diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 90e782dc9..6c23b9f9d 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -426,7 +426,7 @@ const Tooltip = (($) => { $(this.element).on( this.constructor.Event.CLICK, this.config.selector, - $.proxy(this.toggle, this) + (event) => this.toggle(event) ) } else if (trigger !== Trigger.MANUAL) { @@ -441,12 +441,12 @@ const Tooltip = (($) => { .on( eventIn, this.config.selector, - $.proxy(this._enter, this) + (event) => this._enter(event) ) .on( eventOut, this.config.selector, - $.proxy(this._leave, this) + (event) => this._leave(event) ) } }) -- cgit v1.2.3 From a7f1b59959b12ab2e78c32e6954d083601ad45ba Mon Sep 17 00:00:00 2001 From: Johann Date: Tue, 1 Nov 2016 04:33:53 +0100 Subject: Making .tooltip('show') throw an error on elements with display:none (#20940) --- js/src/tooltip.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'js/src/tooltip.js') diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 6c23b9f9d..c4fdbff59 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -239,6 +239,9 @@ const Tooltip = (($) => { } show() { + if ($(this.element).css('display') === 'none') { + throw new Error('Please use show on visible elements') + } let showEvent = $.Event(this.constructor.Event.SHOW) if (this.isWithContent() && this._isEnabled) { -- cgit v1.2.3 From c2616fb74e6bdc0cd46a5678a2c5cffcbe422106 Mon Sep 17 00:00:00 2001 From: Bardi Harborow Date: Tue, 22 Nov 2016 01:36:00 +1100 Subject: Make JS compliant with the new ESLint rules. --- js/src/tooltip.js | 81 +++++++++++++++++++++++++++---------------------------- 1 file changed, 40 insertions(+), 41 deletions(-) (limited to 'js/src/tooltip.js') diff --git a/js/src/tooltip.js b/js/src/tooltip.js index c4fdbff59..822ae3652 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -121,11 +121,11 @@ const Tooltip = (($) => { constructor(element, config) { // private - this._isEnabled = true - this._timeout = 0 - this._hoverState = '' - this._activeTrigger = {} - this._tether = null + this._isEnabled = true + this._timeout = 0 + this._hoverState = '' + this._activeTrigger = {} + this._tether = null // protected this.element = element @@ -184,7 +184,7 @@ const Tooltip = (($) => { toggle(event) { if (event) { - let dataKey = this.constructor.DATA_KEY + const dataKey = this.constructor.DATA_KEY let context = $(event.currentTarget).data(dataKey) if (!context) { @@ -227,11 +227,11 @@ const Tooltip = (($) => { $(this.tip).remove() } - this._isEnabled = null - this._timeout = null - this._hoverState = null - this._activeTrigger = null - this._tether = null + this._isEnabled = null + this._timeout = null + this._hoverState = null + this._activeTrigger = null + this._tether = null this.element = null this.config = null @@ -242,12 +242,12 @@ const Tooltip = (($) => { if ($(this.element).css('display') === 'none') { throw new Error('Please use show on visible elements') } - let showEvent = $.Event(this.constructor.Event.SHOW) + const showEvent = $.Event(this.constructor.Event.SHOW) if (this.isWithContent() && this._isEnabled) { $(this.element).trigger(showEvent) - let isInTheDom = $.contains( + const isInTheDom = $.contains( this.element.ownerDocument.documentElement, this.element ) @@ -256,8 +256,8 @@ const Tooltip = (($) => { return } - let tip = this.getTipElement() - let tipId = Util.getUID(this.constructor.NAME) + const tip = this.getTipElement() + const tipId = Util.getUID(this.constructor.NAME) tip.setAttribute('id', tipId) this.element.setAttribute('aria-describedby', tipId) @@ -268,11 +268,11 @@ const Tooltip = (($) => { $(tip).addClass(ClassName.FADE) } - let placement = typeof this.config.placement === 'function' ? + const placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement - let attachment = this._getAttachment(placement) + const attachment = this._getAttachment(placement) $(tip) .data(this.constructor.DATA_KEY, this) @@ -296,9 +296,9 @@ const Tooltip = (($) => { $(tip).addClass(ClassName.ACTIVE) - let complete = () => { - let prevHoverState = this._hoverState - this._hoverState = null + const complete = () => { + const prevHoverState = this._hoverState + this._hoverState = null $(this.element).trigger(this.constructor.Event.SHOWN) @@ -319,9 +319,9 @@ const Tooltip = (($) => { } hide(callback) { - let tip = this.getTipElement() - let hideEvent = $.Event(this.constructor.Event.HIDE) - let complete = () => { + const tip = this.getTipElement() + const hideEvent = $.Event(this.constructor.Event.HIDE) + const complete = () => { if (this._hoverState !== HoverState.ACTIVE && tip.parentNode) { tip.parentNode.removeChild(tip) } @@ -344,7 +344,7 @@ const Tooltip = (($) => { $(tip).removeClass(ClassName.ACTIVE) if (Util.supportsTransitionEnd() && - ($(this.tip).hasClass(ClassName.FADE))) { + $(this.tip).hasClass(ClassName.FADE)) { $(tip) .one(Util.TRANSITION_END, complete) @@ -365,11 +365,11 @@ const Tooltip = (($) => { } getTipElement() { - return (this.tip = this.tip || $(this.config.template)[0]) + return this.tip = this.tip || $(this.config.template)[0] } setContent() { - let $tip = $(this.getTipElement()) + const $tip = $(this.getTipElement()) this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle()) @@ -381,7 +381,7 @@ const Tooltip = (($) => { } setElementContent($element, content) { - let html = this.config.html + const html = this.config.html if (typeof content === 'object' && (content.nodeType || content.jquery)) { // content is a DOM node or a jQuery if (html) { @@ -422,7 +422,7 @@ const Tooltip = (($) => { } _setListeners() { - let triggers = this.config.trigger.split(' ') + const triggers = this.config.trigger.split(' ') triggers.forEach((trigger) => { if (trigger === 'click') { @@ -433,10 +433,10 @@ const Tooltip = (($) => { ) } else if (trigger !== Trigger.MANUAL) { - let eventIn = trigger === Trigger.HOVER ? + const eventIn = trigger === Trigger.HOVER ? this.constructor.Event.MOUSEENTER : this.constructor.Event.FOCUSIN - let eventOut = trigger === Trigger.HOVER ? + const eventOut = trigger === Trigger.HOVER ? this.constructor.Event.MOUSELEAVE : this.constructor.Event.FOCUSOUT @@ -465,9 +465,9 @@ const Tooltip = (($) => { } _fixTitle() { - let titleType = typeof this.element.getAttribute('data-original-title') + const titleType = typeof this.element.getAttribute('data-original-title') if (this.element.getAttribute('title') || - (titleType !== 'string')) { + titleType !== 'string') { this.element.setAttribute( 'data-original-title', this.element.getAttribute('title') || '' @@ -477,7 +477,7 @@ const Tooltip = (($) => { } _enter(event, context) { - let dataKey = this.constructor.DATA_KEY + const dataKey = this.constructor.DATA_KEY context = context || $(event.currentTarget).data(dataKey) @@ -496,7 +496,7 @@ const Tooltip = (($) => { } if ($(context.getTipElement()).hasClass(ClassName.ACTIVE) || - (context._hoverState === HoverState.ACTIVE)) { + context._hoverState === HoverState.ACTIVE) { context._hoverState = HoverState.ACTIVE return } @@ -518,7 +518,7 @@ const Tooltip = (($) => { } _leave(event, context) { - let dataKey = this.constructor.DATA_KEY + const dataKey = this.constructor.DATA_KEY context = context || $(event.currentTarget).data(dataKey) @@ -557,7 +557,7 @@ const Tooltip = (($) => { } _isWithActiveTrigger() { - for (let trigger in this._activeTrigger) { + for (const trigger in this._activeTrigger) { if (this._activeTrigger[trigger]) { return true } @@ -591,10 +591,10 @@ const Tooltip = (($) => { } _getDelegateConfig() { - let config = {} + const config = {} if (this.config) { - for (let key in this.config) { + for (const key in this.config) { if (this.constructor.Default[key] !== this.config[key]) { config[key] = this.config[key] } @@ -609,9 +609,8 @@ const Tooltip = (($) => { static _jQueryInterface(config) { return this.each(function () { - let data = $(this).data(DATA_KEY) - let _config = typeof config === 'object' ? - config : null + let data = $(this).data(DATA_KEY) + const _config = typeof config === 'object' && config if (!data && /dispose|hide/.test(config)) { return -- cgit v1.2.3 From 0ded703f6bb7b0c60b1ec8e90592c845ca07d46e Mon Sep 17 00:00:00 2001 From: andyexeter Date: Thu, 15 Sep 2016 10:33:11 +0100 Subject: Implement container option for tooltips and popovers. --- js/src/tooltip.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'js/src/tooltip.js') diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 822ae3652..94f77a2a4 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -46,7 +46,8 @@ const Tooltip = (($) => { selector : false, placement : 'top', offset : '0 0', - constraints : [] + constraints : [], + container : false } const DefaultType = { @@ -59,7 +60,8 @@ const Tooltip = (($) => { selector : '(string|boolean)', placement : '(string|function)', offset : 'string', - constraints : 'array' + constraints : 'array', + container : '(string|element|boolean)' } const AttachmentMap = { @@ -274,9 +276,11 @@ const Tooltip = (($) => { const attachment = this._getAttachment(placement) + const container = this.config.container === false ? document.body : $(this.config.container) + $(tip) .data(this.constructor.DATA_KEY, this) - .appendTo(document.body) + .appendTo(container) $(this.element).trigger(this.constructor.Event.INSERTED) -- cgit v1.2.3 From 535fec93cf8892d1a83f6bb8cb97adc589af2b39 Mon Sep 17 00:00:00 2001 From: Bardi Harborow Date: Wed, 30 Nov 2016 04:45:14 +1100 Subject: Hide popovers when their containing modal is closed. (#21227) --- js/src/tooltip.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'js/src/tooltip.js') diff --git a/js/src/tooltip.js b/js/src/tooltip.js index dbc9cf18c..2b659b885 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -224,6 +224,7 @@ const Tooltip = (($) => { $.removeData(this.element, this.constructor.DATA_KEY) $(this.element).off(this.constructor.EVENT_KEY) + $(this.element).closest('.modal').off('hide.bs.modal') if (this.tip) { $(this.tip).remove() @@ -454,6 +455,11 @@ const Tooltip = (($) => { (event) => this._leave(event) ) } + + $(this.element).closest('.modal').on( + 'hide.bs.modal', + () => this.hide() + ) }) if (this.config.selector) { -- cgit v1.2.3 From 297c47c3fdbb58e3d9824afdee83ef3c4b9d141a Mon Sep 17 00:00:00 2001 From: Johann Date: Fri, 2 Dec 2016 18:52:19 +0100 Subject: [V4] Throw error when a plugin is in transition (#17823) * Throw error when a plugin is in transition * Add unit tests about plugins in transition --- js/src/tooltip.js | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'js/src/tooltip.js') diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 2b659b885..dc291a72c 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -123,11 +123,12 @@ const Tooltip = (($) => { constructor(element, config) { // private - this._isEnabled = true - this._timeout = 0 - this._hoverState = '' - this._activeTrigger = {} - this._tether = null + this._isEnabled = true + this._timeout = 0 + this._hoverState = '' + this._activeTrigger = {} + this._isTransitioning = false + this._tether = null // protected this.element = element @@ -245,9 +246,12 @@ const Tooltip = (($) => { if ($(this.element).css('display') === 'none') { throw new Error('Please use show on visible elements') } - const showEvent = $.Event(this.constructor.Event.SHOW) + const showEvent = $.Event(this.constructor.Event.SHOW) if (this.isWithContent() && this._isEnabled) { + if (this._isTransitioning) { + throw new Error('Tooltip is transitioning') + } $(this.element).trigger(showEvent) const isInTheDom = $.contains( @@ -303,7 +307,8 @@ const Tooltip = (($) => { const complete = () => { const prevHoverState = this._hoverState - this._hoverState = null + this._hoverState = null + this._isTransitioning = false $(this.element).trigger(this.constructor.Event.SHOWN) @@ -313,6 +318,7 @@ const Tooltip = (($) => { } if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) { + this._isTransitioning = true $(this.tip) .one(Util.TRANSITION_END, complete) .emulateTransitionEnd(Tooltip._TRANSITION_DURATION) @@ -326,6 +332,9 @@ const Tooltip = (($) => { hide(callback) { const tip = this.getTipElement() const hideEvent = $.Event(this.constructor.Event.HIDE) + if (this._isTransitioning) { + throw new Error('Tooltip is transitioning') + } const complete = () => { if (this._hoverState !== HoverState.ACTIVE && tip.parentNode) { tip.parentNode.removeChild(tip) @@ -333,6 +342,7 @@ const Tooltip = (($) => { this.element.removeAttribute('aria-describedby') $(this.element).trigger(this.constructor.Event.HIDDEN) + this._isTransitioning = false this.cleanupTether() if (callback) { @@ -350,7 +360,7 @@ const Tooltip = (($) => { if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) { - + this._isTransitioning = true $(tip) .one(Util.TRANSITION_END, complete) .emulateTransitionEnd(TRANSITION_DURATION) -- cgit v1.2.3 From bf39bb3ac3d2aef4687b3cd4762015d5f218e2bc Mon Sep 17 00:00:00 2001 From: Starsam80 Date: Thu, 27 Oct 2016 16:13:17 -0600 Subject: Rename `.active` to `.show` --- js/src/tooltip.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'js/src/tooltip.js') diff --git a/js/src/tooltip.js b/js/src/tooltip.js index dc291a72c..3fa5ecab4 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -72,8 +72,8 @@ const Tooltip = (($) => { } const HoverState = { - ACTIVE : 'active', - OUT : 'out' + SHOW : 'show', + OUT : 'out' } const Event = { @@ -90,8 +90,8 @@ const Tooltip = (($) => { } const ClassName = { - FADE : 'fade', - ACTIVE : 'active' + FADE : 'fade', + SHOW : 'show' } const Selector = { @@ -208,7 +208,7 @@ const Tooltip = (($) => { } else { - if ($(this.getTipElement()).hasClass(ClassName.ACTIVE)) { + if ($(this.getTipElement()).hasClass(ClassName.SHOW)) { this._leave(null, this) return } @@ -303,7 +303,7 @@ const Tooltip = (($) => { Util.reflow(tip) this._tether.position() - $(tip).addClass(ClassName.ACTIVE) + $(tip).addClass(ClassName.SHOW) const complete = () => { const prevHoverState = this._hoverState @@ -336,7 +336,7 @@ const Tooltip = (($) => { throw new Error('Tooltip is transitioning') } const complete = () => { - if (this._hoverState !== HoverState.ACTIVE && tip.parentNode) { + if (this._hoverState !== HoverState.SHOW && tip.parentNode) { tip.parentNode.removeChild(tip) } @@ -356,7 +356,7 @@ const Tooltip = (($) => { return } - $(tip).removeClass(ClassName.ACTIVE) + $(tip).removeClass(ClassName.SHOW) if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) { @@ -388,7 +388,7 @@ const Tooltip = (($) => { this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle()) - $tip.removeClass(`${ClassName.FADE} ${ClassName.ACTIVE}`) + $tip.removeClass(`${ClassName.FADE} ${ClassName.SHOW}`) this.cleanupTether() } @@ -513,15 +513,15 @@ const Tooltip = (($) => { ] = true } - if ($(context.getTipElement()).hasClass(ClassName.ACTIVE) || - context._hoverState === HoverState.ACTIVE) { - context._hoverState = HoverState.ACTIVE + if ($(context.getTipElement()).hasClass(ClassName.SHOW) || + context._hoverState === HoverState.SHOW) { + context._hoverState = HoverState.SHOW return } clearTimeout(context._timeout) - context._hoverState = HoverState.ACTIVE + context._hoverState = HoverState.SHOW if (!context.config.delay || !context.config.delay.show) { context.show() @@ -529,7 +529,7 @@ const Tooltip = (($) => { } context._timeout = setTimeout(() => { - if (context._hoverState === HoverState.ACTIVE) { + if (context._hoverState === HoverState.SHOW) { context.show() } }, context.config.delay.show) -- cgit v1.2.3 From aa7f95fd777b5a733bc85c158919d206e05a61b5 Mon Sep 17 00:00:00 2001 From: Max Beatty Date: Mon, 26 Dec 2016 16:21:27 -0800 Subject: update click state when hiding so can be shown again by trigger. fixes #16732 --- js/src/tooltip.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'js/src/tooltip.js') diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 024035fe4..0c1d381b9 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -358,6 +358,10 @@ const Tooltip = (($) => { $(tip).removeClass(ClassName.SHOW) + this._activeTrigger[Trigger.CLICK] = false + this._activeTrigger[Trigger.FOCUS] = false + this._activeTrigger[Trigger.HOVER] = false + if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) { this._isTransitioning = true -- cgit v1.2.3