@@ -2471,8 +2471,8 @@ let rec unsafeCreateElementEx ?_type ?name doc elt =
24712471 Js.Unsafe. coerce
24722472 (document##createElement (Js. string " <input name=\" x\" >" ))
24732473 in
2474- el##.tagName##toLowerCase == Js. string " input"
2475- && el##.name == Js. string " x"
2474+ Js. equals el##.tagName##toLowerCase ( Js. string " input" )
2475+ && Js. equals el##.name ( Js. string " x" )
24762476 with _ -> false
24772477 then `Extended
24782478 else `Standard ;
@@ -2655,20 +2655,20 @@ let html_element : htmlElement t constr = Js.Unsafe.global##._HTMLElement
26552655
26562656module CoerceTo = struct
26572657 let element : #Dom.node Js.t -> element Js.t Js.opt =
2658- if def html_element == undefined
2658+ if not ( Js.Optdef. test (def html_element))
26592659 then
26602660 (* ie < 9 does not have HTMLElement: we have to cheat to check
26612661 that something is an html element *)
26622662 fun e ->
2663- if def (Js.Unsafe. coerce e)##.innerHTML == undefined
2663+ if not ( Js.Optdef. test ( def (Js.Unsafe. coerce e)##.innerHTML))
26642664 then Js. null
26652665 else Js. some (Js.Unsafe. coerce e)
26662666 else
26672667 fun e ->
26682668 if Js. instanceof e html_element then Js. some (Js.Unsafe. coerce e) else Js. null
26692669
26702670 let unsafeCoerce tag (e : #element t ) =
2671- if e##.tagName##toLowerCase == Js. string tag
2671+ if Js. equals e##.tagName##toLowerCase ( Js. string tag)
26722672 then Js. some (Js.Unsafe. coerce e)
26732673 else Js. null
26742674
@@ -2795,7 +2795,7 @@ module CoerceTo = struct
27952795 let video e = unsafeCoerce " video" e
27962796
27972797 let unsafeCoerceEvent constr (ev : #event t ) =
2798- if def constr != undefined && Js. instanceof ev constr
2798+ if Js.Optdef. test ( def constr) && Js. instanceof ev constr
27992799 then Js. some (Js.Unsafe. coerce ev)
28002800 else Js. null
28012801
0 commit comments