diff options
author | Mark Otto <markdotto@gmail.com> | 2018-02-12 01:53:29 +0300 |
---|---|---|
committer | Mark Otto <markdotto@gmail.com> | 2018-02-12 01:53:29 +0300 |
commit | e373fbea9220732283761f3720b4be6280d5135d (patch) | |
tree | 2aac6819b440f92d055cdf9c1961831c92bf01a5 /dist/js/bootstrap.js | |
parent | f81f419b22949d2bf0f4d346891be44724109135 (diff) |
dist
Diffstat (limited to 'dist/js/bootstrap.js')
-rw-r--r-- | dist/js/bootstrap.js | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/dist/js/bootstrap.js b/dist/js/bootstrap.js index 6d9549d991..a182706782 100644 --- a/dist/js/bootstrap.js +++ b/dist/js/bootstrap.js @@ -69,7 +69,7 @@ var Util = function ($$$1) { var MAX_UID = 1000000; // Shoutout AngusCroll (https://goo.gl/pxwQGp) function toType(obj) { - return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase(); + return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase(); } function getSpecialTransitionEndEvent() { @@ -119,13 +119,6 @@ var Util = function ($$$1) { $$$1.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); } } - - function escapeId(selector) { - // We escape IDs in case of special selectors (selector = '#myId:something') - // $.escapeSelector does not exist in jQuery < 3 - selector = typeof $$$1.escapeSelector === 'function' ? $$$1.escapeSelector(selector).substr(1) : selector.replace(/(:|\.|\[|\]|,|=|@)/g, '\\$1'); - return selector; - } /** * -------------------------------------------------------------------------- * Public Util Api @@ -148,11 +141,6 @@ var Util = function ($$$1) { if (!selector || selector === '#') { selector = element.getAttribute('href') || ''; - } // If it's an ID - - - if (selector.charAt(0) === '#') { - selector = escapeId(selector); } try { @@ -1467,12 +1455,14 @@ var Dropdown = function ($$$1) { var Default = { offset: 0, flip: true, - boundary: 'scrollParent' + boundary: 'scrollParent', + reference: 'toggle' }; var DefaultType = { offset: '(number|string|function)', flip: 'boolean', - boundary: '(string|element)' + boundary: '(string|element)', + reference: '(string|element)' /** * ------------------------------------------------------------------------ * Class Definition @@ -1533,11 +1523,15 @@ var Dropdown = function ($$$1) { throw new TypeError('Bootstrap dropdown require Popper.js (https://popper.js.org)'); } - var element = this._element; // For dropup with alignment we use the parent as popper container + var referenceElement = this._element; + + if (this._config.reference === 'parent') { + referenceElement = parent; + } else if (Util.isElement(this._config.reference)) { + referenceElement = this._config.reference; // Check if it's jQuery element - if ($$$1(parent).hasClass(ClassName.DROPUP)) { - if ($$$1(this._menu).hasClass(ClassName.MENULEFT) || $$$1(this._menu).hasClass(ClassName.MENURIGHT)) { - element = parent; + if (typeof this._config.reference.jquery !== 'undefined') { + referenceElement = this._config.reference[0]; } } // If boundary is not `scrollParent`, then set position to `static` // to allow the menu to "escape" the scroll parent's boundaries @@ -1548,7 +1542,7 @@ var Dropdown = function ($$$1) { $$$1(parent).addClass(ClassName.POSITION_STATIC); } - this._popper = new Popper(element, this._menu, this._getPopperConfig()); + this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig()); } // If this is a touch-enabled device we add extra // empty mouseover listeners to the body's immediate children; // only needed because of broken event delegation on iOS |