diff options
| author | Mark Otto <[email protected]> | 2015-08-18 20:28:28 -0700 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2015-08-18 20:28:28 -0700 |
| commit | 3dd48b8d475f727cb5aa63b09388a3a3553629be (patch) | |
| tree | 2eb043bf46073141674c106672ee0ac77614c1aa /js/dist/tooltip.js | |
| parent | 1c19ded8c14cc9caca8ca2992834e2900dbbb4e5 (diff) | |
| download | bootstrap-3dd48b8d475f727cb5aa63b09388a3a3553629be.tar.xz bootstrap-3dd48b8d475f727cb5aa63b09388a3a3553629be.zip | |
js grunt
Diffstat (limited to 'js/dist/tooltip.js')
| -rw-r--r-- | js/dist/tooltip.js | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/js/dist/tooltip.js b/js/dist/tooltip.js index 9f08af16b..a1bd76873 100644 --- a/js/dist/tooltip.js +++ b/js/dist/tooltip.js @@ -154,11 +154,9 @@ var Tooltip = (function ($) { }, { key: 'toggle', value: function toggle(event) { - var context = this; - var dataKey = this.constructor.DATA_KEY; - if (event) { - context = $(event.currentTarget).data(dataKey); + var dataKey = this.constructor.DATA_KEY; + var context = $(event.currentTarget).data(dataKey); if (!context) { context = new this.constructor(event.currentTarget, this._getDelegateConfig()); @@ -173,7 +171,13 @@ var Tooltip = (function ($) { context._leave(null, context); } } else { - $(context.getTipElement()).hasClass(ClassName.IN) ? context._leave(null, context) : context._enter(null, context); + + if ($(this.getTipElement()).hasClass(ClassName.IN)) { + this._leave(null, this); + return; + } + + this._enter(null, this); } } }, { @@ -238,9 +242,9 @@ var Tooltip = (function ($) { $(this.element).trigger(this.constructor.Event.INSERTED); this._tether = new Tether({ + attachment: attachment, element: tip, target: this.element, - attachment: attachment, classes: TetherClass, classPrefix: CLASS_PREFIX, offset: this.config.offset, @@ -263,7 +267,12 @@ var Tooltip = (function ($) { } }; - Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE) ? $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(Tooltip._TRANSITION_DURATION) : complete(); + if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) { + $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(Tooltip._TRANSITION_DURATION); + return; + } + + complete(); } } }, { @@ -310,7 +319,7 @@ var Tooltip = (function ($) { }, { key: 'isWithContent', value: function isWithContent() { - return !!this.getTitle(); + return Boolean(this.getTitle()); } }, { key: 'getTipElement', @@ -373,8 +382,8 @@ var Tooltip = (function ($) { if (trigger === 'click') { $(_this3.element).on(_this3.constructor.Event.CLICK, _this3.config.selector, $.proxy(_this3.toggle, _this3)); } else if (trigger !== Trigger.MANUAL) { - var eventIn = trigger == Trigger.HOVER ? _this3.constructor.Event.MOUSEENTER : _this3.constructor.Event.FOCUSIN; - var eventOut = trigger == Trigger.HOVER ? _this3.constructor.Event.MOUSELEAVE : _this3.constructor.Event.FOCUSOUT; + var eventIn = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSEENTER : _this3.constructor.Event.FOCUSIN; + var eventOut = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSELEAVE : _this3.constructor.Event.FOCUSOUT; $(_this3.element).on(eventIn, _this3.config.selector, $.proxy(_this3._enter, _this3)).on(eventOut, _this3.config.selector, $.proxy(_this3._leave, _this3)); } @@ -416,7 +425,7 @@ var Tooltip = (function ($) { } if (event) { - context._activeTrigger[event.type == 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true; + context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true; } if ($(context.getTipElement()).hasClass(ClassName.IN) || context._hoverState === HoverState.IN) { @@ -452,7 +461,7 @@ var Tooltip = (function ($) { } if (event) { - context._activeTrigger[event.type == 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false; + context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false; } if (context._isWithActiveTrigger()) { @@ -508,9 +517,8 @@ var Tooltip = (function ($) { if (this.config) { for (var key in this.config) { - var value = this.config[key]; - if (this.constructor.Default[key] !== value) { - config[key] = value; + if (this.constructor.Default[key] !== this.config[key]) { + config[key] = this.config[key]; } } } |
