Manually remove handler instead of using once
Since we only want to remove if the target matches.
This commit is contained in:
parent
a48ebe2dd7
commit
9c69f73de5
1 changed files with 4 additions and 2 deletions
|
@ -45,11 +45,13 @@
|
|||
);
|
||||
this.setAttribute('open', true);
|
||||
|
||||
popup.addEventListener('popuphiding', (event) => {
|
||||
let handler = (event) => {
|
||||
if (event.target == popup) {
|
||||
this.setAttribute('open', false);
|
||||
popup.removeEventListener('popuphiding', handler);
|
||||
}
|
||||
}, { once: true });
|
||||
};
|
||||
popup.addEventListener('popuphiding', handler);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue