Manually remove handler instead of using once

Since we only want to remove if the target matches.
This commit is contained in:
Abe Jellinek 2022-06-16 17:33:28 -05:00 committed by Dan Stillman
parent a48ebe2dd7
commit 9c69f73de5

View file

@ -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);
}
});
}