Fix the Screen and ScreenOrientation prototype

This commit is contained in:
Karl Seguin
2025-09-05 19:08:07 +08:00
parent 42828c64fb
commit afd278ca4e
6 changed files with 79 additions and 45 deletions

View File

@@ -0,0 +1,20 @@
<script src="../testing.js"></script>
<script id=screen>
let screen = window.screen;
testing.expectEqual(1920, screen.width);
testing.expectEqual(1080, screen.height);
let orientation = screen.orientation;
testing.expectEqual(0, orientation.angle);
testing.expectEqual('landscape-primary', orientation.type);
// this shouldn't crash (it used to)
screen.addEventListener('change', () => {});
</script>
<script id=orientation>
screen.orientation.addEventListener('change', () => {})
// above shouldn't crash (it used to)
testing.skip();
</script>