Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap-rubygem.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'assets/javascripts/bootstrap/tooltip.js')
-rw-r--r--assets/javascripts/bootstrap/tooltip.js654
1 files changed, 313 insertions, 341 deletions
diff --git a/assets/javascripts/bootstrap/tooltip.js b/assets/javascripts/bootstrap/tooltip.js
index 4aca818..2d3f6b4 100644
--- a/assets/javascripts/bootstrap/tooltip.js
+++ b/assets/javascripts/bootstrap/tooltip.js
@@ -1,26 +1,24 @@
-/* global Tether */
+var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-'use strict';
+var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* --------------------------------------------------------------------------
- * 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)
* --------------------------------------------------------------------------
*/
-var Tooltip = (function ($) {
+var Tooltip = function ($) {
/**
* 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/)');
}
/**
@@ -30,7 +28,7 @@ var Tooltip = (function ($) {
*/
var NAME = 'tooltip';
- var VERSION = '4.0.0-alpha.4';
+ var VERSION = '4.0.0-alpha.5';
var DATA_KEY = 'bs.tooltip';
var EVENT_KEY = '.' + DATA_KEY;
var JQUERY_NO_CONFLICT = $.fn[NAME];
@@ -39,7 +37,7 @@ var Tooltip = (function ($) {
var Default = {
animation: true,
- template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div></div>',
+ template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-inner"></div></div>',
trigger: 'hover focus',
title: '',
delay: 0,
@@ -116,7 +114,7 @@ var Tooltip = (function ($) {
* ------------------------------------------------------------------------
*/
- var Tooltip = (function () {
+ var Tooltip = function () {
function Tooltip(element, config) {
_classCallCheck(this, Tooltip);
@@ -135,439 +133,407 @@ var Tooltip = (function ($) {
this._setListeners();
}
- /**
- * ------------------------------------------------------------------------
- * jQuery
- * ------------------------------------------------------------------------
- */
-
// getters
- _createClass(Tooltip, [{
- key: 'enable',
-
- // public
+ // public
- value: function enable() {
- this._isEnabled = true;
- }
- }, {
- key: 'disable',
- value: function disable() {
- this._isEnabled = false;
- }
- }, {
- key: 'toggleEnabled',
- value: function toggleEnabled() {
- this._isEnabled = !this._isEnabled;
- }
- }, {
- key: 'toggle',
- value: function toggle(event) {
- if (event) {
- var dataKey = this.constructor.DATA_KEY;
- var context = $(event.currentTarget).data(dataKey);
-
- if (!context) {
- context = new this.constructor(event.currentTarget, this._getDelegateConfig());
- $(event.currentTarget).data(dataKey, context);
- }
+ Tooltip.prototype.enable = function enable() {
+ this._isEnabled = true;
+ };
- context._activeTrigger.click = !context._activeTrigger.click;
+ Tooltip.prototype.disable = function disable() {
+ this._isEnabled = false;
+ };
- if (context._isWithActiveTrigger()) {
- context._enter(null, context);
- } else {
- context._leave(null, context);
- }
- } else {
+ Tooltip.prototype.toggleEnabled = function toggleEnabled() {
+ this._isEnabled = !this._isEnabled;
+ };
- if ($(this.getTipElement()).hasClass(ClassName.IN)) {
- this._leave(null, this);
- return;
- }
+ Tooltip.prototype.toggle = function toggle(event) {
+ if (event) {
+ var dataKey = this.constructor.DATA_KEY;
+ var context = $(event.currentTarget).data(dataKey);
- this._enter(null, this);
+ if (!context) {
+ context = new this.constructor(event.currentTarget, this._getDelegateConfig());
+ $(event.currentTarget).data(dataKey, context);
}
- }
- }, {
- key: 'dispose',
- value: function dispose() {
- clearTimeout(this._timeout);
- this.cleanupTether();
+ context._activeTrigger.click = !context._activeTrigger.click;
- $.removeData(this.element, this.constructor.DATA_KEY);
-
- $(this.element).off(this.constructor.EVENT_KEY);
-
- if (this.tip) {
- $(this.tip).remove();
+ if (context._isWithActiveTrigger()) {
+ context._enter(null, context);
+ } else {
+ context._leave(null, context);
}
+ } else {
- this._isEnabled = null;
- this._timeout = null;
- this._hoverState = null;
- this._activeTrigger = null;
- this._tether = null;
+ if ($(this.getTipElement()).hasClass(ClassName.IN)) {
+ this._leave(null, this);
+ return;
+ }
- this.element = null;
- this.config = null;
- this.tip = null;
+ this._enter(null, this);
}
- }, {
- key: 'show',
- value: function show() {
- var _this = this;
+ };
- var showEvent = $.Event(this.constructor.Event.SHOW);
+ Tooltip.prototype.dispose = function dispose() {
+ clearTimeout(this._timeout);
- if (this.isWithContent() && this._isEnabled) {
- $(this.element).trigger(showEvent);
+ this.cleanupTether();
- var isInTheDom = $.contains(this.element.ownerDocument.documentElement, this.element);
+ $.removeData(this.element, this.constructor.DATA_KEY);
- if (showEvent.isDefaultPrevented() || !isInTheDom) {
- return;
- }
+ $(this.element).off(this.constructor.EVENT_KEY);
- var tip = this.getTipElement();
- var tipId = Util.getUID(this.constructor.NAME);
+ if (this.tip) {
+ $(this.tip).remove();
+ }
- tip.setAttribute('id', tipId);
- this.element.setAttribute('aria-describedby', tipId);
+ this._isEnabled = null;
+ this._timeout = null;
+ this._hoverState = null;
+ this._activeTrigger = null;
+ this._tether = null;
- this.setContent();
+ this.element = null;
+ this.config = null;
+ this.tip = null;
+ };
- if (this.config.animation) {
- $(tip).addClass(ClassName.FADE);
- }
+ Tooltip.prototype.show = function show() {
+ var _this = this;
- var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
+ var showEvent = $.Event(this.constructor.Event.SHOW);
- var attachment = this._getAttachment(placement);
+ if (this.isWithContent() && this._isEnabled) {
+ $(this.element).trigger(showEvent);
- $(tip).data(this.constructor.DATA_KEY, this).appendTo(document.body);
+ var isInTheDom = $.contains(this.element.ownerDocument.documentElement, this.element);
- $(this.element).trigger(this.constructor.Event.INSERTED);
+ if (showEvent.isDefaultPrevented() || !isInTheDom) {
+ return;
+ }
- this._tether = new Tether({
- attachment: attachment,
- element: tip,
- target: this.element,
- classes: TetherClass,
- classPrefix: CLASS_PREFIX,
- offset: this.config.offset,
- constraints: this.config.constraints,
- addTargetClasses: false
- });
+ var tip = this.getTipElement();
+ var tipId = Util.getUID(this.constructor.NAME);
- Util.reflow(tip);
- this._tether.position();
+ tip.setAttribute('id', tipId);
+ this.element.setAttribute('aria-describedby', tipId);
- $(tip).addClass(ClassName.IN);
+ this.setContent();
- var complete = function complete() {
- var prevHoverState = _this._hoverState;
- _this._hoverState = null;
+ if (this.config.animation) {
+ $(tip).addClass(ClassName.FADE);
+ }
- $(_this.element).trigger(_this.constructor.Event.SHOWN);
+ var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
- if (prevHoverState === HoverState.OUT) {
- _this._leave(null, _this);
- }
- };
+ var attachment = this._getAttachment(placement);
- if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
- $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(Tooltip._TRANSITION_DURATION);
- return;
- }
+ $(tip).data(this.constructor.DATA_KEY, this).appendTo(document.body);
- complete();
- }
- }
- }, {
- key: 'hide',
- value: function hide(callback) {
- var _this2 = this;
+ $(this.element).trigger(this.constructor.Event.INSERTED);
+
+ this._tether = new Tether({
+ attachment: attachment,
+ element: tip,
+ target: this.element,
+ classes: TetherClass,
+ classPrefix: CLASS_PREFIX,
+ offset: this.config.offset,
+ constraints: this.config.constraints,
+ addTargetClasses: false
+ });
+
+ Util.reflow(tip);
+ this._tether.position();
+
+ $(tip).addClass(ClassName.IN);
- var tip = this.getTipElement();
- var hideEvent = $.Event(this.constructor.Event.HIDE);
var complete = function complete() {
- if (_this2._hoverState !== HoverState.IN && tip.parentNode) {
- tip.parentNode.removeChild(tip);
- }
+ var prevHoverState = _this._hoverState;
+ _this._hoverState = null;
- _this2.element.removeAttribute('aria-describedby');
- $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
- _this2.cleanupTether();
+ $(_this.element).trigger(_this.constructor.Event.SHOWN);
- if (callback) {
- callback();
+ if (prevHoverState === HoverState.OUT) {
+ _this._leave(null, _this);
}
};
- $(this.element).trigger(hideEvent);
-
- if (hideEvent.isDefaultPrevented()) {
+ if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
+ $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(Tooltip._TRANSITION_DURATION);
return;
}
- $(tip).removeClass(ClassName.IN);
+ complete();
+ }
+ };
- if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
+ Tooltip.prototype.hide = function hide(callback) {
+ var _this2 = this;
- $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
- } else {
- complete();
+ var tip = this.getTipElement();
+ var hideEvent = $.Event(this.constructor.Event.HIDE);
+ var complete = function complete() {
+ if (_this2._hoverState !== HoverState.IN && tip.parentNode) {
+ tip.parentNode.removeChild(tip);
}
- this._hoverState = '';
- }
+ _this2.element.removeAttribute('aria-describedby');
+ $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
+ _this2.cleanupTether();
- // protected
+ if (callback) {
+ callback();
+ }
+ };
- }, {
- key: 'isWithContent',
- value: function isWithContent() {
- return Boolean(this.getTitle());
- }
- }, {
- key: 'getTipElement',
- value: function getTipElement() {
- return this.tip = this.tip || $(this.config.template)[0];
+ $(this.element).trigger(hideEvent);
+
+ if (hideEvent.isDefaultPrevented()) {
+ return;
}
- }, {
- key: 'setContent',
- value: function setContent() {
- var $tip = $(this.getTipElement());
- this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle());
+ $(tip).removeClass(ClassName.IN);
- $tip.removeClass(ClassName.FADE).removeClass(ClassName.IN);
+ if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
- this.cleanupTether();
+ $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
+ } else {
+ complete();
}
- }, {
- key: 'setElementContent',
- value: function setElementContent($element, content) {
- var html = this.config.html;
- if (typeof content === 'object' && (content.nodeType || content.jquery)) {
- // content is a DOM node or a jQuery
- if (html) {
- if (!$(content).parent().is($element)) {
- $element.empty().append(content);
- }
- } else {
- $element.text($(content).text());
+
+ this._hoverState = '';
+ };
+
+ // protected
+
+ Tooltip.prototype.isWithContent = function isWithContent() {
+ return Boolean(this.getTitle());
+ };
+
+ Tooltip.prototype.getTipElement = function getTipElement() {
+ return this.tip = this.tip || $(this.config.template)[0];
+ };
+
+ Tooltip.prototype.setContent = function setContent() {
+ var $tip = $(this.getTipElement());
+
+ this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle());
+
+ $tip.removeClass(ClassName.FADE).removeClass(ClassName.IN);
+
+ this.cleanupTether();
+ };
+
+ Tooltip.prototype.setElementContent = function setElementContent($element, content) {
+ var html = this.config.html;
+ if ((typeof content === 'undefined' ? 'undefined' : _typeof(content)) === 'object' && (content.nodeType || content.jquery)) {
+ // content is a DOM node or a jQuery
+ if (html) {
+ if (!$(content).parent().is($element)) {
+ $element.empty().append(content);
}
} else {
- $element[html ? 'html' : 'text'](content);
+ $element.text($(content).text());
}
+ } else {
+ $element[html ? 'html' : 'text'](content);
}
- }, {
- key: 'getTitle',
- value: function getTitle() {
- var title = this.element.getAttribute('data-original-title');
+ };
- if (!title) {
- title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
- }
+ Tooltip.prototype.getTitle = function getTitle() {
+ var title = this.element.getAttribute('data-original-title');
- return title;
- }
- }, {
- key: 'cleanupTether',
- value: function cleanupTether() {
- if (this._tether) {
- this._tether.destroy();
- }
+ if (!title) {
+ title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
}
- // private
+ return title;
+ };
- }, {
- key: '_getAttachment',
- value: function _getAttachment(placement) {
- return AttachmentMap[placement.toUpperCase()];
+ Tooltip.prototype.cleanupTether = function cleanupTether() {
+ if (this._tether) {
+ this._tether.destroy();
}
- }, {
- key: '_setListeners',
- value: function _setListeners() {
- var _this3 = this;
+ };
- var triggers = this.config.trigger.split(' ');
+ // private
- triggers.forEach(function (trigger) {
- 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;
+ Tooltip.prototype._getAttachment = function _getAttachment(placement) {
+ return AttachmentMap[placement.toUpperCase()];
+ };
- $(_this3.element).on(eventIn, _this3.config.selector, $.proxy(_this3._enter, _this3)).on(eventOut, _this3.config.selector, $.proxy(_this3._leave, _this3));
- }
- });
+ Tooltip.prototype._setListeners = function _setListeners() {
+ var _this3 = this;
- if (this.config.selector) {
- this.config = $.extend({}, this.config, {
- trigger: 'manual',
- selector: ''
- });
- } else {
- this._fixTitle();
- }
- }
- }, {
- key: '_fixTitle',
- value: function _fixTitle() {
- var titleType = typeof this.element.getAttribute('data-original-title');
- if (this.element.getAttribute('title') || titleType !== 'string') {
- this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
- this.element.setAttribute('title', '');
+ var triggers = this.config.trigger.split(' ');
+
+ triggers.forEach(function (trigger) {
+ 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;
+
+ $(_this3.element).on(eventIn, _this3.config.selector, $.proxy(_this3._enter, _this3)).on(eventOut, _this3.config.selector, $.proxy(_this3._leave, _this3));
}
+ });
+
+ if (this.config.selector) {
+ this.config = $.extend({}, this.config, {
+ trigger: 'manual',
+ selector: ''
+ });
+ } else {
+ this._fixTitle();
}
- }, {
- key: '_enter',
- value: function _enter(event, context) {
- var dataKey = this.constructor.DATA_KEY;
+ };
- context = context || $(event.currentTarget).data(dataKey);
+ Tooltip.prototype._fixTitle = function _fixTitle() {
+ var titleType = _typeof(this.element.getAttribute('data-original-title'));
+ if (this.element.getAttribute('title') || titleType !== 'string') {
+ this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
+ this.element.setAttribute('title', '');
+ }
+ };
- if (!context) {
- context = new this.constructor(event.currentTarget, this._getDelegateConfig());
- $(event.currentTarget).data(dataKey, context);
- }
+ Tooltip.prototype._enter = function _enter(event, context) {
+ var dataKey = this.constructor.DATA_KEY;
- if (event) {
- context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
- }
+ context = context || $(event.currentTarget).data(dataKey);
- if ($(context.getTipElement()).hasClass(ClassName.IN) || context._hoverState === HoverState.IN) {
- context._hoverState = HoverState.IN;
- return;
- }
+ if (!context) {
+ context = new this.constructor(event.currentTarget, this._getDelegateConfig());
+ $(event.currentTarget).data(dataKey, context);
+ }
- clearTimeout(context._timeout);
+ if (event) {
+ context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
+ }
+ if ($(context.getTipElement()).hasClass(ClassName.IN) || context._hoverState === HoverState.IN) {
context._hoverState = HoverState.IN;
+ return;
+ }
+
+ clearTimeout(context._timeout);
+
+ context._hoverState = HoverState.IN;
- if (!context.config.delay || !context.config.delay.show) {
+ if (!context.config.delay || !context.config.delay.show) {
+ context.show();
+ return;
+ }
+
+ context._timeout = setTimeout(function () {
+ if (context._hoverState === HoverState.IN) {
context.show();
- return;
}
+ }, context.config.delay.show);
+ };
- context._timeout = setTimeout(function () {
- if (context._hoverState === HoverState.IN) {
- context.show();
- }
- }, context.config.delay.show);
- }
- }, {
- key: '_leave',
- value: function _leave(event, context) {
- var dataKey = this.constructor.DATA_KEY;
+ Tooltip.prototype._leave = function _leave(event, context) {
+ var dataKey = this.constructor.DATA_KEY;
- context = context || $(event.currentTarget).data(dataKey);
+ context = context || $(event.currentTarget).data(dataKey);
- if (!context) {
- context = new this.constructor(event.currentTarget, this._getDelegateConfig());
- $(event.currentTarget).data(dataKey, context);
- }
+ if (!context) {
+ context = new this.constructor(event.currentTarget, this._getDelegateConfig());
+ $(event.currentTarget).data(dataKey, context);
+ }
- if (event) {
- context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
- }
+ if (event) {
+ context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
+ }
- if (context._isWithActiveTrigger()) {
- return;
- }
+ if (context._isWithActiveTrigger()) {
+ return;
+ }
+
+ clearTimeout(context._timeout);
- clearTimeout(context._timeout);
+ context._hoverState = HoverState.OUT;
- context._hoverState = HoverState.OUT;
+ if (!context.config.delay || !context.config.delay.hide) {
+ context.hide();
+ return;
+ }
- if (!context.config.delay || !context.config.delay.hide) {
+ context._timeout = setTimeout(function () {
+ if (context._hoverState === HoverState.OUT) {
context.hide();
- return;
}
+ }, context.config.delay.hide);
+ };
- context._timeout = setTimeout(function () {
- if (context._hoverState === HoverState.OUT) {
- context.hide();
- }
- }, context.config.delay.hide);
- }
- }, {
- key: '_isWithActiveTrigger',
- value: function _isWithActiveTrigger() {
- for (var trigger in this._activeTrigger) {
- if (this._activeTrigger[trigger]) {
- return true;
- }
+ Tooltip.prototype._isWithActiveTrigger = function _isWithActiveTrigger() {
+ for (var trigger in this._activeTrigger) {
+ if (this._activeTrigger[trigger]) {
+ return true;
}
-
- return false;
}
- }, {
- key: '_getConfig',
- value: function _getConfig(config) {
- config = $.extend({}, this.constructor.Default, $(this.element).data(), config);
-
- if (config.delay && typeof config.delay === 'number') {
- config.delay = {
- show: config.delay,
- hide: config.delay
- };
- }
- Util.typeCheckConfig(NAME, config, this.constructor.DefaultType);
+ return false;
+ };
+
+ Tooltip.prototype._getConfig = function _getConfig(config) {
+ config = $.extend({}, this.constructor.Default, $(this.element).data(), config);
- return config;
+ if (config.delay && typeof config.delay === 'number') {
+ config.delay = {
+ show: config.delay,
+ hide: config.delay
+ };
}
- }, {
- key: '_getDelegateConfig',
- value: function _getDelegateConfig() {
- var config = {};
-
- if (this.config) {
- for (var key in this.config) {
- if (this.constructor.Default[key] !== this.config[key]) {
- config[key] = this.config[key];
- }
+
+ Util.typeCheckConfig(NAME, config, this.constructor.DefaultType);
+
+ return config;
+ };
+
+ Tooltip.prototype._getDelegateConfig = function _getDelegateConfig() {
+ var config = {};
+
+ if (this.config) {
+ for (var key in this.config) {
+ if (this.constructor.Default[key] !== this.config[key]) {
+ config[key] = this.config[key];
}
}
-
- return config;
}
- // static
+ return config;
+ };
- }], [{
- key: '_jQueryInterface',
- value: function _jQueryInterface(config) {
- return this.each(function () {
- var data = $(this).data(DATA_KEY);
- var _config = typeof config === 'object' ? config : null;
+ // static
- if (!data && /destroy|hide/.test(config)) {
- return;
- }
+ Tooltip._jQueryInterface = function _jQueryInterface(config) {
+ return this.each(function () {
+ var data = $(this).data(DATA_KEY);
+ var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' ? config : null;
- if (!data) {
- data = new Tooltip(this, _config);
- $(this).data(DATA_KEY, data);
- }
+ if (!data && /dispose|hide/.test(config)) {
+ return;
+ }
- if (typeof config === 'string') {
- if (data[config] === undefined) {
- throw new Error('No method named "' + config + '"');
- }
- data[config]();
+ if (!data) {
+ data = new Tooltip(this, _config);
+ $(this).data(DATA_KEY, data);
+ }
+
+ if (typeof config === 'string') {
+ if (data[config] === undefined) {
+ throw new Error('No method named "' + config + '"');
}
- });
- }
- }, {
+ data[config]();
+ }
+ });
+ };
+
+ _createClass(Tooltip, null, [{
key: 'VERSION',
get: function get() {
return VERSION;
@@ -605,7 +571,13 @@ var Tooltip = (function ($) {
}]);
return Tooltip;
- })();
+ }();
+
+ /**
+ * ------------------------------------------------------------------------
+ * jQuery
+ * ------------------------------------------------------------------------
+ */
$.fn[NAME] = Tooltip._jQueryInterface;
$.fn[NAME].Constructor = Tooltip;
@@ -615,4 +587,4 @@ var Tooltip = (function ($) {
};
return Tooltip;
-})(jQuery);
+}(jQuery); /* global Tether */