Module Js_of_ocaml__.Dom
DOM objects
class type 'node nodeList = object ... endSpecification of
NodeListobjects.
type nodeType=|OTHER|ELEMENT|ATTRIBUTE|TEXT|CDATA_SECTION|ENTITY_REFERENCE|ENTITY|PROCESSING_INSTRUCTION|COMMENT|DOCUMENT|DOCUMENT_TYPE|DOCUMENT_FRAGMENT|NOTATION
module DocumentPosition : sig ... endclass type node = object ... endSpecification of
Nodeobjects.
class type attr = object ... endSpecification of
Attrobjects.
and 'node namedNodeMap = object ... endSpecification of
NamedNodeMapobjects.
and element = object ... endSpecification of
Elementobjects.
class type characterData = object ... endSpecification of
CharacterDataobjects.
class type comment = characterDataSpecification of
Commentobjects
class type text = characterDataSpecification of
Textobjects.
class type documentFragment = nodeSpecification of
DocumentFragmentobjects.
class type 'element document = object ... endSpecification of
Documentobjects.
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 cinserts nodenas child of nodep, just before nodec, or as last child ifpis empty. The expressioninsertBefore n c pbehave the same asp##insertBefore n cbut avoid the need of coercing the different objects tonode 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 cbehave the same asp##replaceChild n c(replacecbyninp) but avoid the need of coercing the different objects tonode t.
val removeChild : node Js_of_ocaml.Js.t -> node Js_of_ocaml.Js.t -> unitThe expression
removeChild n cbehave the same asn##removeChild c(removecfromn) but avoid the need of coercing the different objects tonode t.
val appendChild : node Js_of_ocaml.Js.t -> node Js_of_ocaml.Js.t -> unitThe expression
appendChild n cbehave the same asn##appendChild c(appendscton) but avoid the need of coercing the different objects tonode t.
val list_of_nodeList : 'a nodeList Js_of_ocaml.Js.t -> 'a Js_of_ocaml.Js.t list
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
val nodeType : node Js_of_ocaml.Js.t -> node_type
module CoerceTo : sig ... endEvents
type (-'a, -'b) event_listenerThe type of event listener functions. The first type parameter
'ais the type of the target object; the second parameter'bis the type of the event object.
class type 'a event = object ... endclass type ['a, 'b] customEvent = object ... endEvent handlers
val no_handler : ('a, 'b) event_listenerVoid event handler (Javascript
nullvalue).
val handler : ('e event Js_of_ocaml.Js.t as 'b -> bool Js_of_ocaml.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_of_ocaml.Js.t as 'b -> bool Js_of_ocaml.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_of_ocaml.Js.tInvoke an existing handler. Useful to chain event handlers.
val eventTarget : < .. > as 'a event Js_of_ocaml.Js.t -> 'a Js_of_ocaml.Js.tReturns which object is the target of this event. It raises
Not_foundin case there is no target (if the event has not been triggered yet)
module Event : sig ... endval addEventListenerWithOptions : < .. > Js_of_ocaml.Js.t as 'a -> 'b 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) event_listener -> event_listener_idAdd an event listener. This function matches the option-object variant of the
addEventListenerDOM method, except that it returns an id for removing the listener.
val addEventListener : < .. > Js_of_ocaml.Js.t as 'a -> 'b Event.typ -> ('a, 'b) event_listener -> bool Js_of_ocaml.Js.t -> event_listener_idAdd an event listener. This function matches the useCapture boolean variant of the
addEventListenerDOM method, except that it returns an id for removing the listener.
val removeEventListener : event_listener_id -> unitRemove the given event listener.
val preventDefault : 'a event Js_of_ocaml.Js.t -> unitCall 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 Event.typ -> ('a, 'b) customEvent Js_of_ocaml.Js.tCreate a custom event of given type.
Other DOM objects
class type stringList = object ... end