File tree Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Original file line number Diff line number Diff line change @@ -309,20 +309,12 @@ module Current = struct
309
309
else l##.search)
310
310
311
311
let get_fragment () =
312
- (* location.hash doesn't have the same behavior depending on the browser
313
- Firefox bug : https://bugzilla.mozilla.org/show_bug.cgi?id=483304 *)
314
- (* let s = Js.to_bytestring (l##hash) in *)
315
- (* if String.length s > 0 && s.[0] = '#' *)
316
- (* then String.sub s 1 (String.length s - 1) *)
317
- (* else s; *)
318
- Js.Opt. case
319
- (l##.href##_match (new % js Js. regExp (Js. string " #(.*)" )))
320
- (fun () -> " " )
321
- (fun res ->
322
- let res = Js. match_result res in
323
- Js. to_string (Js.Unsafe. get res 1 ))
324
-
325
- let set_fragment s = l##.hash := Js. bytestring (urlencode s)
312
+ let s = Js. to_bytestring l##.hash in
313
+ if String. length s > 0 && Char. equal s.[0 ] '#'
314
+ then String. sub s 1 (String. length s - 1 )
315
+ else s
316
+
317
+ let set_fragment s = l##.hash := Js. bytestring s
326
318
327
319
let get () = url_of_js_string l##.href
328
320
You can’t perform that action at this time.
0 commit comments