diff options
author | XhmikosR <xhmikosr@gmail.com> | 2019-03-01 19:31:34 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-01 19:31:34 +0300 |
commit | 19aee321a027edaa60c3087bfcf6c9f1517c9b98 (patch) | |
tree | 8ddcf12dcd3d08527150fa5020d7236e2a8f9c8f /js/dist/popover.js | |
parent | d47d29aeaa69c37cc7fb9d1691fa7b73290053f9 (diff) |
Dist (#28392)
Diffstat (limited to 'js/dist/popover.js')
-rw-r--r-- | js/dist/popover.js | 71 |
1 files changed, 43 insertions, 28 deletions
diff --git a/js/dist/popover.js b/js/dist/popover.js index 26a67313bd..115716fa57 100644 --- a/js/dist/popover.js +++ b/js/dist/popover.js @@ -4,12 +4,13 @@ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('./tooltip.js')) : - typeof define === 'function' && define.amd ? define(['jquery', './tooltip.js'], factory) : - (global = global || self, global.Popover = factory(global.jQuery, global.Tooltip)); -}(this, function ($, Tooltip) { 'use strict'; + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/selectorEngine.js'), require('./tooltip.js')) : + typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/selectorEngine.js', './tooltip.js'], factory) : + (global = global || self, global.Popover = factory(global.Data, global.SelectorEngine, global.Tooltip)); +}(this, function (Data, SelectorEngine, Tooltip) { 'use strict'; - $ = $ && $.hasOwnProperty('default') ? $['default'] : $; + Data = Data && Data.hasOwnProperty('default') ? Data['default'] : Data; + SelectorEngine = SelectorEngine && SelectorEngine.hasOwnProperty('default') ? SelectorEngine['default'] : SelectorEngine; Tooltip = Tooltip && Tooltip.hasOwnProperty('default') ? Tooltip['default'] : Tooltip; function _defineProperties(target, props) { @@ -69,6 +70,14 @@ } /** + * -------------------------------------------------------------------------- + * Bootstrap (v4.3.1): util/index.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * -------------------------------------------------------------------------- + */ + var jQuery = window.jQuery; // Shoutout AngusCroll (https://goo.gl/pxwQGp) + + /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ @@ -78,7 +87,6 @@ var VERSION = '4.3.1'; var DATA_KEY = 'bs.popover'; var EVENT_KEY = "." + DATA_KEY; - var JQUERY_NO_CONFLICT = $.fn[NAME]; var CLASS_PREFIX = 'bs-popover'; var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g'); @@ -86,7 +94,7 @@ placement: 'right', trigger: 'click', content: '', - template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>' + template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>' }); var DefaultType = _objectSpread({}, Tooltip.DefaultType, { @@ -137,18 +145,13 @@ }; _proto.addAttachmentClass = function addAttachmentClass(attachment) { - $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment); - }; - - _proto.getTipElement = function getTipElement() { - this.tip = this.tip || $(this.config.template)[0]; - return this.tip; + this.getTipElement().classList.add(CLASS_PREFIX + "-" + attachment); }; _proto.setContent = function setContent() { - var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events + var tip = this.getTipElement(); // we use append for html objects to maintain js events - this.setElementContent($tip.find(Selector.TITLE), this.getTitle()); + this.setElementContent(SelectorEngine.findOne(Selector.TITLE, tip), this.getTitle()); var content = this._getContent(); @@ -156,8 +159,9 @@ content = content.call(this.element); } - this.setElementContent($tip.find(Selector.CONTENT), content); - $tip.removeClass(ClassName.FADE + " " + ClassName.SHOW); + this.setElementContent(SelectorEngine.findOne(Selector.CONTENT, tip), content); + tip.classList.remove(ClassName.FADE); + tip.classList.remove(ClassName.SHOW); } // Private ; @@ -166,18 +170,22 @@ }; _proto._cleanTipClass = function _cleanTipClass() { - var $tip = $(this.getTipElement()); - var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); + var tip = this.getTipElement(); + var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX); if (tabClass !== null && tabClass.length > 0) { - $tip.removeClass(tabClass.join('')); + tabClass.map(function (token) { + return token.trim(); + }).forEach(function (tClass) { + return tip.classList.remove(tClass); + }); } } // Static ; Popover._jQueryInterface = function _jQueryInterface(config) { return this.each(function () { - var data = $(this).data(DATA_KEY); + var data = Data.getData(this, DATA_KEY); var _config = typeof config === 'object' ? config : null; @@ -187,7 +195,7 @@ if (!data) { data = new Popover(this, _config); - $(this).data(DATA_KEY, data); + Data.setData(this, DATA_KEY, data); } if (typeof config === 'string') { @@ -200,6 +208,10 @@ }); }; + Popover._getInstance = function _getInstance(element) { + return Data.getData(element, DATA_KEY); + }; + _createClass(Popover, null, [{ key: "VERSION", // Getters @@ -247,13 +259,16 @@ */ - $.fn[NAME] = Popover._jQueryInterface; - $.fn[NAME].Constructor = Popover; + if (typeof jQuery !== 'undefined') { + var JQUERY_NO_CONFLICT = jQuery.fn[NAME]; + jQuery.fn[NAME] = Popover._jQueryInterface; + jQuery.fn[NAME].Constructor = Popover; - $.fn[NAME].noConflict = function () { - $.fn[NAME] = JQUERY_NO_CONFLICT; - return Popover._jQueryInterface; - }; + jQuery.fn[NAME].noConflict = function () { + jQuery.fn[NAME] = JQUERY_NO_CONFLICT; + return Popover._jQueryInterface; + }; + } return Popover; |