File tree Expand file tree Collapse file tree 3 files changed +12
-9
lines changed Expand file tree Collapse file tree 3 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,11 @@ pub const CSSStyleDeclaration = struct {
3333 store : std .StringHashMapUnmanaged (Property ),
3434 order : std .ArrayListUnmanaged ([]const u8 ),
3535
36+ pub const empty : CSSStyleDeclaration = .{
37+ .store = .empty ,
38+ .order = .empty ,
39+ };
40+
3641 const Property = struct {
3742 value : []const u8 ,
3843 priority : bool ,
Original file line number Diff line number Diff line change @@ -109,10 +109,7 @@ pub const HTMLElement = struct {
109109 pub const prototype = * Element ;
110110 pub const subtype = .node ;
111111
112- style : CSSStyleDeclaration = .{
113- .store = .{},
114- .order = .{},
115- },
112+ style : CSSStyleDeclaration = .empty ,
116113
117114 pub fn get_style (e : * parser.ElementHTML , state : * SessionState ) ! * CSSStyleDeclaration {
118115 const self = try state .getOrCreateNodeWrapper (HTMLElement , @ptrCast (e ));
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ const Console = @import("../console/console.zig").Console;
3131const EventTarget = @import ("../dom/event_target.zig" ).EventTarget ;
3232const MediaQueryList = @import ("media_query_list.zig" ).MediaQueryList ;
3333const Performance = @import ("performance.zig" ).Performance ;
34+ const CSSStyleDeclaration = @import ("../cssom/css_style_declaration.zig" ).CSSStyleDeclaration ;
3435
3536const storage = @import ("../storage/storage.zig" );
3637
@@ -237,13 +238,13 @@ pub const Window = struct {
237238 return timer_id ;
238239 }
239240
240- // NOT IMPLEMENTED - This is a dummy implementation that always returns null to deter PlayWright from using this path to solve click.js.
241- // returns an object containing the values of all CSS properties of an element, after applying active stylesheets and resolving any basic computation those values may contain.
242- pub fn _getComputedStyle (_ : * Window , element : * parser.Element , pseudo_element : ? []const u8 ) ! ? void {
241+ // TODO: getComputedStyle should return a read-only CSSStyleDeclaration.
242+ // We currently don't have a read-only one, so we return a new instance on
243+ // each call.
244+ pub fn _getComputedStyle (_ : * Window , element : * parser.Element , pseudo_element : ? []const u8 ) ! CSSStyleDeclaration {
243245 _ = element ;
244246 _ = pseudo_element ;
245- log .warn ("Not implemented function getComputedStyle called, null returned" , .{});
246- return null ;
247+ return .empty ;
247248 }
248249};
249250
You can’t perform that action at this time.
0 commit comments