Module Js_of_ocaml.DomSource
DOM binding
This is a partial binding to the DOM Core API.
DOM objects
Specification of NamedNodeMap objects.
Specification of CharacterData objects.
Specification of Comment objects
Specification of Text objects.
Specification of DocumentFragment objects.
Helper functions
val insertBefore :
node Js_of_ocaml.Js.t ->
node Js_of_ocaml.Js.t ->
node Js_of_ocaml.Js.t Js_of_ocaml.Js.opt ->
unitinsertBefore p n c inserts node n as child of node p, just before node c, or as last child if p is empty. The expression insertBefore n c p behave the same as p##insertBefore n c but avoid the need of coercing the different objects to node t.
val replaceChild :
node Js_of_ocaml.Js.t ->
node Js_of_ocaml.Js.t ->
node Js_of_ocaml.Js.t ->
unitThe expression replaceChild p n c behave the same as p##replaceChild n c (replace c by n in p) but avoid the need of coercing the different objects to node t.
The expression removeChild n c behave the same as n##removeChild c (remove c from n) but avoid the need of coercing the different objects to node t.
The expression appendChild n c behave the same as n##appendChild c (appends c to n) but avoid the need of coercing the different objects to node t.
type node_type = | Element of element Js_of_ocaml.Js.t| Attr of attr Js_of_ocaml.Js.t| Text of text Js_of_ocaml.Js.t| Other of node Js_of_ocaml.Js.t
Events
The type of event listener functions. The first type parameter 'a is the type of the target object; the second parameter 'b is the type of the event object.
Event handlers
Void event handler (Javascript null value).
val handler :
(('e event Js_of_ocaml.Js.t as 'b) -> bool Js_of_ocaml.Js.t) ->
('a, 'b) Js_of_ocaml.Dom.event_listenerCreate an event handler that invokes the provided function. If the handler returns false, the default action is prevented.
val full_handler :
('a -> ('e event Js_of_ocaml.Js.t as 'b) -> bool Js_of_ocaml.Js.t) ->
('a, 'b) Js_of_ocaml.Dom.event_listenerCreate an event handler that invokes the provided function. The event target (implicit parameter this) is also passed as argument to the function.
val invoke_handler :
('a, 'b) Js_of_ocaml.Dom.event_listener ->
'a ->
'b ->
bool Js_of_ocaml.Js.tInvoke an existing handler. Useful to chain event handlers.
Returns which object is the target of this event. It raises Not_found in case there is no target (if the event has not been triggered yet)
val addEventListenerWithOptions :
(< .. > Js_of_ocaml.Js.t as 'a) ->
'b Js_of_ocaml.Dom.Event.typ ->
?capture:bool Js_of_ocaml.Js.t ->
?once:bool Js_of_ocaml.Js.t ->
?passive:bool Js_of_ocaml.Js.t ->
('a, 'b) Js_of_ocaml.Dom.event_listener ->
Js_of_ocaml.Dom.event_listener_idAdd an event listener. This function matches the option-object variant of the addEventListener DOM method, except that it returns an id for removing the listener.
val addEventListener :
(< .. > Js_of_ocaml.Js.t as 'a) ->
'b Js_of_ocaml.Dom.Event.typ ->
('a, 'b) Js_of_ocaml.Dom.event_listener ->
bool Js_of_ocaml.Js.t ->
Js_of_ocaml.Dom.event_listener_idAdd an event listener. This function matches the useCapture boolean variant of the addEventListener DOM method, except that it returns an id for removing the listener.
Remove the given event listener.
Call this to prevent the default handler for the event. To stop propagation of the event, call Dom_html.stopPropagation.
val createCustomEvent :
?bubbles:bool ->
?cancelable:bool ->
?detail:'b ->
['a, 'b] customEvent Js_of_ocaml.Js.t Js_of_ocaml.Dom.Event.typ ->
('a, 'b) customEvent Js_of_ocaml.Js.tCreate a custom event of given type.