1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-09-25 21:09:06 +02:00

dropdown - destroy old popper.js references

This commit is contained in:
Johann-S
2019-08-18 22:05:20 +02:00
parent a5e725fa2e
commit 6885d65578
2 changed files with 44 additions and 6 deletions

View File

@@ -155,10 +155,6 @@ class Dropdown {
// Disable totally Popper.js for Dropdown in Navbar
if (!this._inNavbar) {
/**
* Check for Popper dependency
* Popper - https://popper.js.org
*/
if (typeof Popper === 'undefined') {
throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org)')
}
@@ -251,7 +247,7 @@ class Dropdown {
EventHandler.off(this._element, EVENT_KEY)
this._element = null
this._menu = null
if (this._popper !== null) {
if (this._popper) {
this._popper.destroy()
this._popper = null
}
@@ -259,7 +255,7 @@ class Dropdown {
update() {
this._inNavbar = this._detectNavbar()
if (this._popper !== null) {
if (this._popper) {
this._popper.scheduleUpdate()
}
}
@@ -440,6 +436,10 @@ class Dropdown {
toggles[i].setAttribute('aria-expanded', 'false')
if (context._popper) {
context._popper.destroy()
}
dropdownMenu.classList.remove(ClassName.SHOW)
parent.classList.remove(ClassName.SHOW)
EventHandler.trigger(parent, Event.HIDDEN, relatedTarget)