Js_of_ocaml.DomDOM binding
This is a partial binding to the DOM Core API.
class type 'node nodeList = object ... endSpecification of NodeList objects.
module DocumentPosition : sig ... endclass type node = object ... endSpecification of Node objects.
class type attr = object ... endSpecification of Attr objects.
class type 'node namedNodeMap = object ... endSpecification of NamedNodeMap objects.
class type element = object ... endSpecification of Element objects.
class type characterData = object ... endSpecification of CharacterData objects.
class type comment = characterDataSpecification of Comment objects
class type text = characterDataSpecification of Text objects.
class type documentFragment = nodeSpecification of DocumentFragment objects.
class type 'element document = object ... endSpecification of Document objects.
insertBefore 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.
The 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.
module CoerceTo : sig ... endThe 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.
class type 'a event = object ... endclass type ['a, 'b] customEvent = object ... endval no_handler : ('a, 'b) event_listenerVoid event handler (Javascript null value).
val handler : (('e event Js.t as 'b) -> bool Js.t) -> ('a, 'b) 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.t as 'b) -> bool Js.t) ->
('a, 'b) 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) event_listener -> 'a -> 'b -> bool 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)
module Event : sig ... endval addEventListenerWithOptions :
(< .. > Js.t as 'a) ->
'b Event.typ ->
?capture:bool Js.t ->
?once:bool Js.t ->
?passive:bool Js.t ->
('a, 'b) event_listener ->
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.t as 'a) ->
'b Event.typ ->
('a, 'b) event_listener ->
bool Js.t ->
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.
val removeEventListener : event_listener_id -> unitRemove 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.t Event.typ ->
('a, 'b) customEvent Js.tCreate a custom event of given type.
class type stringList = object ... end