|
22 | 22 | fullScreenChange(),
|
23 | 23 | ]);
|
24 | 24 |
|
25 |
| - assert_equals(document.fullscreenElement, first); |
26 |
| - assert_equals(firstEvent.target, first); |
| 25 | + assert_equals(document.fullscreenElement, first, "fullscreen element after first request"); |
| 26 | + assert_equals(firstEvent.target, first, "first fullscreenchange event target"); |
27 | 27 |
|
28 | 28 | const last = document.getElementById("last");
|
29 |
| - const [, lastEvent] = await Promise.all([ |
| 29 | + const [, secondEvent] = await Promise.all([ |
30 | 30 | trusted_request(last),
|
31 | 31 | fullScreenChange(),
|
32 | 32 | ]);
|
33 | 33 |
|
34 |
| - assert_equals(document.fullscreenElement, last); |
35 |
| - assert_equals(event.target, last); |
| 34 | + assert_equals(document.fullscreenElement, last, "fullscreen element after second request"); |
| 35 | + assert_equals(secondEvent.target, last, "second fullscreenchange event target"); |
36 | 36 | last.remove();
|
37 |
| - // Because /last/ was removed from the top layer, we exit |
38 |
| - // fullscreen element synchronously. |
39 |
| - assert_equals(document.fullscreenElement, first); |
| 37 | + // Although /last/ was removed from the top layer synchronously, /first/ remains |
| 38 | + // and becomes the new fullscreen element. |
| 39 | + assert_equals(document.fullscreenElement, first, "fullscreen element immediately after removal"); |
40 | 40 |
|
41 |
| - const finalEvent = await fullScreenChange(); |
42 |
| - // fullscreen change element should be queued against the |
43 |
| - // document target. |
44 |
| - assert_equals(document.fullscreenElement, null); |
45 |
| - assert_equals(event.target, document); |
| 41 | + // The removal of the fullscreen element triggers exiting fullscreen, but those changes |
| 42 | + // happen async when the event is fired. |
| 43 | + const thirdEvent = await fullScreenChange(); |
| 44 | + assert_equals(document.fullscreenElement, null, "fullscreen element after third event"); |
| 45 | + assert_equals(thirdEvent.target, document, "third fullscreenchange event target"); |
46 | 46 | });
|
47 | 47 | </script>
|
0 commit comments