File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ pub const NodeList = struct {
110110 try self .nodes .append (alloc , node );
111111 }
112112
113- pub fn get_length (self : * NodeList ) u32 {
113+ pub fn get_length (self : * const NodeList ) u32 {
114114 return @intCast (self .nodes .items .len );
115115 }
116116
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ const MediaQueryList = @import("media_query_list.zig").MediaQueryList;
3434const Performance = @import ("../dom/performance.zig" ).Performance ;
3535const CSSStyleDeclaration = @import ("../cssom/CSSStyleDeclaration.zig" );
3636const Screen = @import ("screen.zig" ).Screen ;
37+ const domcss = @import ("../dom/css.zig" );
3738const Css = @import ("../css/css.zig" ).Css ;
3839
3940const Function = Env .Function ;
@@ -134,9 +135,16 @@ pub const Window = struct {
134135 pub fn get_frames (self : * Window ) * Window {
135136 return self ;
136137 }
137- // TODO: frames
138- pub fn get_length (_ : * Window ) u32 {
139- return 0 ;
138+
139+ // Retrieve the numbre of frames/iframes from the DOM dynamically.
140+ pub fn get_length (self : * const Window , page : * Page ) ! u32 {
141+ const frames = try domcss .querySelectorAll (
142+ page .call_arena ,
143+ parser .documentHTMLToNode (self .document ),
144+ "frame,iframe" ,
145+ );
146+
147+ return frames .get_length ();
140148 }
141149
142150 pub fn get_top (self : * Window ) * Window {
You can’t perform that action at this time.
0 commit comments