-let selection_changed mathview (node : Ominidom.o_mDOMNode option) =
- let module O = Ominidom in
- print_string ("selection_changed: " ^
- (match node with
- None -> "selection_changed on nothing"
- | Some node ->
- match node#get_name with
- | Some x -> x#get_string
- | None -> "on element without name"
- ) ^ "\n");
- mathview#set_selection node;
- flush stdout
+let element_over mathview ((element : Gdome.element option), _, _, _) =
+ print_endline ("element_over: " ^
+ (match element with
+ None -> "element_over on nothing"
+ | Some element -> element#get_tagName#to_string
+ )
+ ) ;
+ flush stdout
+;;
+
+let rec jump (element : Gdome.element) =
+ let module G = Gdome in
+ let attr = (element#getAttribute ~name:(G.domString "href"))#to_string in
+ if attr = "" then
+ match element#get_parentNode with
+ Some p ->
+ begin
+ try
+ jump (new Gdome.element_of_node p)
+ with
+ GdomeInit.DOMCastException _ ->
+ print_string "jump: NO HREF FOR THIS NODE\n" ;
+ flush stdout ;
+ false
+ end
+ | None -> assert false (* every element has a parent *)
+ else
+ begin
+ print_endline ("jump: " ^ attr) ;
+ flush stdout ;
+ true
+ end