1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-26 06:44:35 +02:00

test(Modal): check if modal is disposed

This commit is contained in:
Andrew Luca
2018-10-19 01:26:11 +03:00
committed by Johann-S
parent 65dc8c9070
commit bd2851938a
2 changed files with 43 additions and 2 deletions

View File

@@ -196,9 +196,17 @@ class Modal {
}
dispose() {
$.removeData(this._element, DATA_KEY)
[window, this._element, this._dialog]
.forEach((htmlElement) => $(htmlElement).off(EVENT_KEY))
$(window, document, this._element, this._backdrop).off(EVENT_KEY)
/**
* `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
* Do not move `document` in `htmlElements` array
* It will remove `Event.CLICK_DATA_API` event that should remain
*/
$(document).off(Event.FOCUSIN)
$.removeData(this._element, DATA_KEY)
this._config = null
this._element = null