mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-18 10:52:19 +01:00
Dropdown: use a combined selector to filter foreign not shown instances iteration (#35766)
This commit is contained in:
parent
4b17868fb4
commit
353ad45b4b
@ -50,6 +50,7 @@ const CLASS_NAME_DROPEND = 'dropend'
|
||||
const CLASS_NAME_DROPSTART = 'dropstart'
|
||||
|
||||
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="dropdown"]'
|
||||
const SELECTOR_DATA_TOGGLE_SHOWN = `${SELECTOR_DATA_TOGGLE}.${CLASS_NAME_SHOW}`
|
||||
const SELECTOR_MENU = '.dropdown-menu'
|
||||
const SELECTOR_NAVBAR = '.navbar'
|
||||
const SELECTOR_NAVBAR_NAV = '.navbar-nav'
|
||||
@ -341,18 +342,14 @@ class Dropdown extends BaseComponent {
|
||||
return
|
||||
}
|
||||
|
||||
const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE)
|
||||
const openToggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE_SHOWN)
|
||||
|
||||
for (const toggle of toggles) {
|
||||
for (const toggle of openToggles) {
|
||||
const context = Dropdown.getInstance(toggle)
|
||||
if (!context || context._config.autoClose === false) {
|
||||
continue
|
||||
}
|
||||
|
||||
if (!context._isShown()) {
|
||||
continue
|
||||
}
|
||||
|
||||
const composedPath = event.composedPath()
|
||||
const isMenuTarget = composedPath.includes(context._menu)
|
||||
if (
|
||||
|
Loading…
x
Reference in New Issue
Block a user