File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,10 @@ let onIE = Js.to_bool (caml_js_on_ie ())
2727
2828external html_escape : js_string t -> js_string t = " caml_js_html_escape"
2929
30- external decode_html_entities : js_string t -> js_string t = " caml_js_html_entities"
30+ external html_entities : js_string t -> js_string t opt = " caml_js_html_entities"
31+
32+ let decode_html_entities s =
33+ Js.Opt. get (html_entities s) (fun () -> failwith (" Invalid entity " ^ Js. to_string s))
3134
3235class type cssStyleDeclaration = object
3336 method setProperty :
Original file line number Diff line number Diff line change @@ -37,7 +37,6 @@ function caml_js_html_escape (s) {
3737}
3838
3939//Provides: caml_js_html_entities
40- //Requires: caml_failwith
4140function caml_js_html_entities ( s ) {
4241 var entity = / ^ & # ? [ 0 - 9 a - z A - Z ] + ; $ /
4342 if ( s . match ( entity ) )
@@ -49,7 +48,7 @@ function caml_js_html_entities(s) {
4948 return str ;
5049 }
5150 else {
52- caml_failwith ( "Invalid entity " + s ) ;
51+ return null ;
5352 }
5453}
5554
You can’t perform that action at this time.
0 commit comments