mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-15 10:05:40 +02:00
dist
This commit is contained in:
20
js/dist/dropdown.js
vendored
20
js/dist/dropdown.js
vendored
@@ -75,12 +75,14 @@ var Dropdown = function ($) {
|
||||
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
|
||||
@@ -141,11 +143,15 @@ var Dropdown = function ($) {
|
||||
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 ($(parent).hasClass(ClassName.DROPUP)) {
|
||||
if ($(this._menu).hasClass(ClassName.MENULEFT) || $(this._menu).hasClass(ClassName.MENURIGHT)) {
|
||||
element = parent;
|
||||
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 (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
|
||||
@@ -156,7 +162,7 @@ var Dropdown = function ($) {
|
||||
$(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
|
||||
|
2
js/dist/dropdown.js.map
vendored
2
js/dist/dropdown.js.map
vendored
File diff suppressed because one or more lines are too long
14
js/dist/util.js
vendored
14
js/dist/util.js
vendored
@@ -14,7 +14,7 @@ var Util = function ($) {
|
||||
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() {
|
||||
@@ -64,13 +64,6 @@ var Util = function ($) {
|
||||
$.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 $.escapeSelector === 'function' ? $.escapeSelector(selector).substr(1) : selector.replace(/(:|\.|\[|\]|,|=|@)/g, '\\$1');
|
||||
return selector;
|
||||
}
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Public Util Api
|
||||
@@ -93,11 +86,6 @@ var Util = function ($) {
|
||||
|
||||
if (!selector || selector === '#') {
|
||||
selector = element.getAttribute('href') || '';
|
||||
} // If it's an ID
|
||||
|
||||
|
||||
if (selector.charAt(0) === '#') {
|
||||
selector = escapeId(selector);
|
||||
}
|
||||
|
||||
try {
|
||||
|
2
js/dist/util.js.map
vendored
2
js/dist/util.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user