Commit 1baf9c81 authored by lucas.coatanlem's avatar lucas.coatanlem
Browse files

Removed test_register3 from all files as we know that he is functionnal.

Modified files to make a primitive from register_event.
register_event in progress (start 2)
parent af6fcd98
......@@ -68,15 +68,6 @@ let replace_outer id str =
| Some elem -> elem ## outerHTML <- (Js.string str)
let test_register3 id str1 str2 =
(* replace id by str1@str2 *)
let elem = Dom_html.document ## getElementById (Js.string id) in
let str = str1^str2 in
match Js.Opt.to_option elem with
None -> Value.failwith' ("No element with id : " ^ id)
| Some elem -> elem ## innerHTML <- (Js.string str)
let simple_js_to_cduce v =
(* Pour la valeur v, si elle est changeable (string), on le fait, sinon on renvoie None *)
match Js.to_string (Js.typeof v) with
......@@ -137,6 +128,6 @@ let use () =
;
Print_xml.replace_inner := replace_inner;
Print_xml.replace_outer := replace_outer;
Print_xml.test_register3 := test_register3;
Print_xml.register_event := register_event;
define_prims()
......@@ -223,4 +223,4 @@ let dump_xml ~utf8 ns_table s =
(* TODO Lucas : A effacer? *)
let replace_inner = ref (fun _ _ -> failwith "unimplemented primitive")
let replace_outer = ref (fun _ _ -> failwith "unimplemented primitive")
let test_register3 = ref (fun _ _ _ -> failwith "unimplemented primitive")
let register_event = ref (fun _ _ _ -> failwith "unimplemented primitive")
......@@ -5,4 +5,4 @@ val print_xml_subst: utf8:bool -> Ns.table -> Value.t ->
val replace_inner : (string -> string -> unit) ref
val replace_outer : (string -> string -> unit) ref
val test_register3 : (string -> string -> string -> unit) ref
val register_event : (Value.t -> Value.t -> Value.t -> unit) ref
......@@ -9,5 +9,4 @@ let doc = load_xml "foo"
let [] = replace_outer "foo" (print_xml <div id="bar1">[])
(* "<div id='bar' />" *)
let [] = replace_inner "bar1" (print_xml <div id="bar2">[])
let [] = test_register3 "bar2" "a" "b"
let [] = print (print_xml doc)
\ No newline at end of file
......@@ -264,13 +264,13 @@ register_fun2 "replace_outer"
Value.nil
);;
register_fun3 "test_register3"
string_latin1 string_latin1 string_latin1 nil
(fun a b c ->
!Print_xml.test_register3
(Value.get_string_latin1 a)
(Value.get_string_latin1 b)
(Value.get_string_latin1 c);
register_fun3 "register_event"
any any any nil
(fun id event handler ->
!Print_xml.register_event
id
event
handler;
Value.nil);;
register_fun "print"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment