From 876eb2f6464bb462de422c50dc14ad8842bba4f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Vouillon?= Date: Tue, 3 Oct 2023 23:47:17 +0200 Subject: [PATCH] Do not use physical equality on JavaScript values --- src/lib/client/eliommod_dom.ml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/lib/client/eliommod_dom.ml b/src/lib/client/eliommod_dom.ml index 6b005ec29a..22c4b67cb1 100644 --- a/src/lib/client/eliommod_dom.ml +++ b/src/lib/client/eliommod_dom.ml @@ -83,7 +83,7 @@ let fast_ancessor (elt1 : #Dom.node Js.t) (elt2 : #Dom.node Js.t) = let slow_ancessor (elt1 : #Dom.node Js.t) (elt2 : #Dom.node Js.t) = let rec check_parent n = - if n == (elt1 :> Dom.node Js.t) + if Js.strict_equals n (elt1 :> Dom.node Js.t) then true else match Js.Opt.to_option n##.parentNode with @@ -162,20 +162,20 @@ let slow_has_classes (node : Dom_html.element Js.t) = let found_attrib = ref false in for i = 0 to classes##.length - 1 do found_call_service := - Js.array_get classes i - == Js.def (Js.string Eliom_runtime.RawXML.ce_call_service_class) + Js.Optdef.strict_equals (Js.array_get classes i) + (Js.def (Js.string Eliom_runtime.RawXML.ce_call_service_class)) || !found_call_service; found_process_node := - Js.array_get classes i - == Js.def (Js.string Eliom_runtime.RawXML.process_node_class) + Js.Optdef.strict_equals (Js.array_get classes i) + (Js.def (Js.string Eliom_runtime.RawXML.process_node_class)) || !found_process_node; found_closure := - Js.array_get classes i - == Js.def (Js.string Eliom_runtime.RawXML.ce_registered_closure_class) + Js.Optdef.strict_equals (Js.array_get classes i) + (Js.def (Js.string Eliom_runtime.RawXML.ce_registered_closure_class)) || !found_closure; found_attrib := - Js.array_get classes i - == Js.def (Js.string Eliom_runtime.RawXML.ce_registered_attr_class) + Js.Optdef.strict_equals (Js.array_get classes i) + (Js.def (Js.string Eliom_runtime.RawXML.ce_registered_attr_class)) || !found_attrib done; !found_call_service, !found_process_node, !found_closure, !found_attrib @@ -185,8 +185,8 @@ let slow_has_request_class (node : Dom_html.element Js.t) = let found_request_node = ref false in for i = 0 to classes##.length - 1 do found_request_node := - Js.array_get classes i - == Js.def (Js.string Eliom_runtime.RawXML.request_node_class) + Js.Optdef.strict_equals (Js.array_get classes i) + (Js.def (Js.string Eliom_runtime.RawXML.request_node_class)) || !found_request_node done; !found_request_node @@ -788,7 +788,7 @@ let onhashchange f = else let last_fragment = ref Dom_html.window##.location##.hash in let check () = - if !last_fragment != Dom_html.window##.location##.hash + if not (Js.equals !last_fragment Dom_html.window##.location##.hash) then ( last_fragment := Dom_html.window##.location##.hash; f Dom_html.window##.location##.hash)