Skip to content

Commit 9bcaaab

Browse files
committed
Simple window.top implementation (not frame-aware)
1 parent 9abead7 commit 9bcaaab

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/browser/html/window.zig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ pub const Window = struct {
117117
return self;
118118
}
119119

120+
// TODO: frames
121+
pub fn get_top(self: *Window) *Window {
122+
return self;
123+
}
124+
120125
pub fn get_document(self: *Window) ?*parser.DocumentHTML {
121126
return self.document;
122127
}
@@ -292,6 +297,11 @@ test "Browser.HTML.Window" {
292297
var runner = try testing.jsRunner(testing.tracking_allocator, .{});
293298
defer runner.deinit();
294299

300+
try runner.testCases(&.{
301+
.{ "window.parent === window", "true" },
302+
.{ "window.top === window", "true" },
303+
}, .{});
304+
295305
// requestAnimationFrame should be able to wait by recursively calling itself
296306
// Note however that we in this test do not wait as the request is just send to the browser
297307
try runner.testCases(&.{

0 commit comments

Comments
 (0)