Skip to content

File tree

7 files changed

+20
-0
lines changed

7 files changed

+20
-0
lines changed

CHANGES

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
===== dev =====
2+
* Add toggle event for details elements.
3+
14
===== 10.4.1 =====
25
* Update to OCaml 5.2 (thanks to Kate Deplaix)
36

src/lib/eliom_content.client.mli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,7 @@ module Html : sig
666666
val onreturn : ('a, Dom_html.keyboardEvent) ev_unit
667667
val onchange : ('a, Dom_html.event) ev
668668
val onchange_select : ('a, Dom_html.event) ev
669+
val ontoggle : ('a, Dom_html.toggleEvent) ev
669670
end
670671

671672
module Attr : sig

src/lib/eliom_content_.client.ml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,14 @@ module Html = struct
516516
(fun () -> failwith (Printf.sprintf "Non element node (%s)" name))
517517
id
518518

519+
let get_unique_elt_details name elt : Dom_html.detailsElement Js.t =
520+
Js.Opt.case
521+
(Js.Opt.bind
522+
(Dom_html.CoerceTo.element (get_unique_node name elt))
523+
Dom_html.CoerceTo.details)
524+
(fun () -> failwith (Printf.sprintf "Non element node (%s)" name))
525+
id
526+
519527
let scrollIntoView ?(bottom = false) elt =
520528
let elt = get_unique_elt "Css.background" elt in
521529
elt ## (scrollIntoView (Js.bool (not bottom)))
@@ -612,6 +620,10 @@ module Html = struct
612620
let onchange_select elt f =
613621
let elt = get_unique_elt_select "Ev.onchange_select" elt in
614622
elt##.onchange := bool_cb f
623+
624+
let ontoggle elt f =
625+
let elt = get_unique_elt_details "Ev.ontoggle" elt in
626+
elt##.ontoggle := bool_cb f
615627
end
616628

617629
module Attr = struct

src/lib/eliom_content_core.client.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ module Html = struct
393393
let a_onsubmit s = A.Unsafe.string_attrib "onsubmit" s
394394
let a_onsuspend s = A.Unsafe.string_attrib "onsuspend" s
395395
let a_ontimeupdate s = A.Unsafe.string_attrib "ontimeupdate" s
396+
let a_ontoggle s = A.Unsafe.string_attrib "ontoggle" s
396397
let a_onundo s = A.Unsafe.string_attrib "onundo" s
397398
let a_onunload s = A.Unsafe.string_attrib "onunload" s
398399
let a_onvolumechange s = A.Unsafe.string_attrib "onvolumechange" s

src/lib/eliom_content_core.client.mli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ module Html : sig
388388
val a_onsubmit : string -> [> `OnSubmit] A.attrib
389389
val a_onsuspend : string -> [> `OnSuspend] A.attrib
390390
val a_ontimeupdate : string -> [> `OnTimeUpdate] A.attrib
391+
val a_ontoggle : string -> [> `OnToggle] A.attrib
391392
val a_onundo : string -> [> `OnUndo] A.attrib
392393
val a_onunload : string -> [> `OnUnload] A.attrib
393394
val a_onvolumechange : string -> [> `OnVolumeChange] A.attrib

src/lib/eliom_content_core.server.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ module Html = struct
411411
let a_onsubmit s = A.Unsafe.string_attrib "onsubmit" s
412412
let a_onsuspend s = A.Unsafe.string_attrib "onsuspend" s
413413
let a_ontimeupdate s = A.Unsafe.string_attrib "ontimeupdate" s
414+
let a_ontoggle s = A.Unsafe.string_attrib "ontoggle" s
414415
let a_onundo s = A.Unsafe.string_attrib "onundo" s
415416
let a_onunload s = A.Unsafe.string_attrib "onunload" s
416417
let a_onvolumechange s = A.Unsafe.string_attrib "onvolumechange" s

src/lib/eliom_content_core.server.mli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ module Html : sig
256256
val a_onsubmit : string -> [> `OnSubmit] A.attrib
257257
val a_onsuspend : string -> [> `OnSuspend] A.attrib
258258
val a_ontimeupdate : string -> [> `OnTimeUpdate] A.attrib
259+
val a_ontoggle : string -> [> `OnToggle] A.attrib
259260
val a_onundo : string -> [> `OnUndo] A.attrib
260261
val a_onunload : string -> [> `OnUnload] A.attrib
261262
val a_onvolumechange : string -> [> `OnVolumeChange] A.attrib

0 commit comments

Comments
 (0)