mirror of https://github.com/twbs/bootstrap.git
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 CLASS_NAME_DROPSTART = 'dropstart'
|
||||||
|
|
||||||
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="dropdown"]'
|
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_MENU = '.dropdown-menu'
|
||||||
const SELECTOR_NAVBAR = '.navbar'
|
const SELECTOR_NAVBAR = '.navbar'
|
||||||
const SELECTOR_NAVBAR_NAV = '.navbar-nav'
|
const SELECTOR_NAVBAR_NAV = '.navbar-nav'
|
||||||
|
@ -341,18 +342,14 @@ class Dropdown extends BaseComponent {
|
||||||
return
|
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)
|
const context = Dropdown.getInstance(toggle)
|
||||||
if (!context || context._config.autoClose === false) {
|
if (!context || context._config.autoClose === false) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!context._isShown()) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
const composedPath = event.composedPath()
|
const composedPath = event.composedPath()
|
||||||
const isMenuTarget = composedPath.includes(context._menu)
|
const isMenuTarget = composedPath.includes(context._menu)
|
||||||
if (
|
if (
|
||||||
|
|
Loading…
Reference in New Issue