Skip to content

Commit a4f6acd

Browse files
committed
Add class setting in script execution
1 parent 5e0959b commit a4f6acd

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/engine/step/actions.ml

+12-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ module AttributeActions = struct
9393
let arg =
9494
Jv.obj
9595
[|
96-
( "set_class",
96+
( "set_style",
9797
Jv.callback ~arity:3 @@ fun elem style value ->
9898
let old_value =
9999
let old_value = Brr.El.inline_style style elem in
@@ -109,6 +109,17 @@ module AttributeActions = struct
109109
in
110110
undos_ref := undo :: !undos_ref;
111111
Jv.callback ~arity:1 undo );
112+
( "set_class",
113+
Jv.callback ~arity:3 @@ fun elem class_ bool ->
114+
let bool = Jv.to_bool bool in
115+
Brr.Console.(log [ "set_class called with"; elem; class_; bool ]);
116+
let old_value = Brr.El.class' class_ elem in
117+
Brr.El.set_class class_ bool elem;
118+
let undo _ =
119+
Fut.return @@ Brr.El.set_class class_ old_value elem
120+
in
121+
undos_ref := undo :: !undos_ref;
122+
Jv.callback ~arity:1 undo );
112123
|]
113124
in
114125
let u = f arg in

0 commit comments

Comments
 (0)