Skip to content

Commit

Permalink
Do not use physical equality on JavaScript values
Browse files Browse the repository at this point in the history
  • Loading branch information
vouillon committed Sep 21, 2024
1 parent 684ea6f commit 876eb2f
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/lib/client/eliommod_dom.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 876eb2f

Please sign in to comment.