1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-08 14:46:34 +02:00

Fix conflict with Bootstrap CSS

This commit is contained in:
Martijn Cuppens
2020-11-25 22:12:32 +02:00
committed by XhmikosR
parent 4447157446
commit d8f247392d
2 changed files with 24 additions and 27 deletions

View File

@@ -57,7 +57,6 @@ const CLASS_NAME_SHOW = 'show'
const CLASS_NAME_DROPUP = 'dropup'
const CLASS_NAME_DROPEND = 'dropend'
const CLASS_NAME_DROPSTART = 'dropstart'
const CLASS_NAME_MENUEND = 'dropdown-menu-end'
const CLASS_NAME_NAVBAR = 'navbar'
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="dropdown"]'
@@ -268,22 +267,23 @@ class Dropdown extends BaseComponent {
_getPlacement() {
const parentDropdown = this._element.parentNode
let placement = PLACEMENT_BOTTOM
// Handle dropup
if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
placement = this._menu.classList.contains(CLASS_NAME_MENUEND) ?
PLACEMENT_TOPEND :
PLACEMENT_TOP
} else if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) {
placement = PLACEMENT_RIGHT
} else if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) {
placement = PLACEMENT_LEFT
} else if (this._menu.classList.contains(CLASS_NAME_MENUEND)) {
placement = PLACEMENT_BOTTOMEND
if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) {
return PLACEMENT_RIGHT
}
return placement
if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) {
return PLACEMENT_LEFT
}
// We need to trim the value because custom properties can also include spaces
const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end'
if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP
}
return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM
}
_detectNavbar() {