File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ const EventHandler = @import("../events/event.zig").EventHandler;
2929
3030const DOMException = @import ("exceptions.zig" ).DOMException ;
3131const Nod = @import ("node.zig" );
32+ const Window = @import ("../html/window.zig" ).Window ;
3233
3334// EventTarget interfaces
3435pub const Union = Nod .Union ;
@@ -40,9 +41,10 @@ pub const EventTarget = struct {
4041 pub const mem_guarantied = true ;
4142
4243 pub fn toInterface (et : * parser.EventTarget ) ! Union {
43- // NOTE: for now we state that all EventTarget are Nodes
44- // TODO: handle other types (eg. Window)
45- return Nod .Node .toInterface (@as (* parser .Node , @ptrCast (et )));
44+ return switch (try parser .eventTargetGetType (et )) {
45+ .window = > .{ .Window = @as (* Window , @ptrCast (et )) },
46+ .node = > Nod .Node .toInterface (@as (* parser .Node , @ptrCast (et ))),
47+ };
4648 }
4749
4850 // JS funcs
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ pub const Window = struct {
5757 return Window {
5858 .target = target orelse "" ,
5959 .navigator = navigator orelse .{},
60+ .base = .{ .et_type = @intFromEnum (parser .EventTargetType .window ) },
6061 };
6162 }
6263
You can’t perform that action at this time.
0 commit comments