From ad94b746bfb7c8db13d870f25b593548fb443b24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Vouillon?= Date: Tue, 3 Oct 2023 23:37:09 +0200 Subject: [PATCH] Do not use physical equality on JavaScript values --- src/widgets/ot_carousel.eliom | 5 +++-- src/widgets/ot_lib.eliom | 4 ++-- src/widgets/ot_nodeready.eliom | 8 +++++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/widgets/ot_carousel.eliom b/src/widgets/ot_carousel.eliom index 222972e6..44a65932 100644 --- a/src/widgets/ot_carousel.eliom +++ b/src/widgets/ot_carousel.eliom @@ -284,8 +284,9 @@ let%shared make ?(a = []) ?(vertical = false) ?(position = 0) (Js.Unsafe.coerce d2'##.style)##.webkitTransform := s; let move = not - (before == (Js.Unsafe.coerce d2'##.style)##.transform - || before == (Js.Unsafe.coerce d2'##.style)##.webkitTransform) + (Js.strict_equals before (Js.Unsafe.coerce d2'##.style)##.transform + || Js.strict_equals before + (Js.Unsafe.coerce d2'##.style)##.webkitTransform) in let step = React.Step.create () in pos_set ~step pos; diff --git a/src/widgets/ot_lib.eliom b/src/widgets/ot_lib.eliom index 489903b0..69c8e2e0 100644 --- a/src/widgets/ot_lib.eliom +++ b/src/widgets/ot_lib.eliom @@ -78,8 +78,8 @@ let%client window_scrolls ?(ios_html_scroll_hack = false) ?use_capture handler = (fun () -> stop_thread (); Lwt.cancel !cur; Lwt.return_unit) let%client rec in_ancestors ~elt ~ancestor = - elt == (ancestor : Dom_html.element Js.t) - || (not (elt == Dom_html.document##.body)) + Js.strict_equals elt (ancestor : Dom_html.element Js.t) + || (not (Js.strict_equals elt Dom_html.document##.body)) && Js.Opt.case elt##.parentNode (fun () -> false) (fun parent -> diff --git a/src/widgets/ot_nodeready.eliom b/src/widgets/ot_nodeready.eliom index 15e55a5a..704dfc5c 100644 --- a/src/widgets/ot_nodeready.eliom +++ b/src/widgets/ot_nodeready.eliom @@ -25,7 +25,7 @@ open Js_of_ocaml let debug = false let rec node_in_document node = - node == (Dom_html.document :> Dom.node Js.t) + Js.strict_equals node (Dom_html.document :> Dom.node Js.t) || Js.Opt.case node##.parentNode (fun () -> false) node_in_document type t = @@ -81,7 +81,9 @@ let nodeready n = else ( if !watched = [] then observer##observe Dom_html.document config; try - let {thread} = List.find (fun {node} -> n == node) !watched in + let {thread} = + List.find (fun {node} -> Js.strict_equals n node) !watched + in log ~n "already being watched"; thread with Not_found -> @@ -93,7 +95,7 @@ let nodeready n = in Eliom_client.Page_status.ondead ~stop (fun () -> let instances_of_node, rest = - List.partition (fun {node} -> n == node) !watched + List.partition (fun {node} -> Js.strict_equals n node) !watched in watched := rest; instances_of_node