Skip to content

Commit 6a61009

Browse files
Merge pull request #859 from monster-echo/main
remove backdropEl with certain element
2 parents f3514c3 + 31984fc commit 6a61009

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/components/modal/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ class Modal implements ModalInterface {
8181
_createBackdrop() {
8282
if (this._isHidden) {
8383
const backdropEl = document.createElement('div');
84-
backdropEl.setAttribute('modal-backdrop', '');
8584
backdropEl.classList.add(
8685
...this._options.backdropClasses.split(' ')
8786
);
@@ -91,8 +90,9 @@ class Modal implements ModalInterface {
9190
}
9291

9392
_destroyBackdropEl() {
94-
if (!this._isHidden) {
95-
document.querySelector('[modal-backdrop]').remove();
93+
if (!this._isHidden && this._backdropEl) {
94+
this._backdropEl.remove();
95+
this._backdropEl = null
9696
}
9797
}
9898

0 commit comments

Comments
 (0)