Skip to content

Commit

Permalink
Fixes #48176
Browse files Browse the repository at this point in the history
This PR fixes the issue, by adding the 2nd event listener
only after the first one has been fired.
  • Loading branch information
theIDinside authored and emilio committed Sep 14, 2024
1 parent 6f8ccf3 commit 307a251
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions fullscreen/api/document-exit-fullscreen-twice.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@
"fullscreenElement after second exitFullscreen()"
);
const eventChange = new Promise((resolve) => {
document.addEventListener("fullscreenchange", resolve, once);
document.addEventListener(
"fullscreenchange",
t.unreached_func("second event fired"),
once
);
document.addEventListener("fullscreenchange", () => {
document.addEventListener("fullscreenchange", t.unreached_func("second event fired"), once);
resolve();
}, once);
});

await Promise.all([
Expand Down

0 comments on commit 307a251

Please sign in to comment.