package js_of_ocaml
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=e59bbffcaefaba3191620556514b7f53bb3249e3f881a070d72724234dffd819
sha512=bb470f316f9c81a3b2b8dedd0b0f18f8e06beb48dd70df1d9f846de90ffab439cab5ef7a93a8166af0998068b06097e8319bc0d9f4f23a7159b0de8b3b515746
doc/js_of_ocaml/Js_of_ocaml/Dom_html/index.html
Module Js_of_ocaml.Dom_htmlSource
DOM HTML binding
This is a partial binding to the DOM HTML API.
CSS style declaration
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.
DOMStringMap used for the dataset property. Use the DomStringMap module for typed access.
Common properties of event target objects: onclick, onkeypress, ...
HTML elements
Rectangular box (used for element bounding boxes)
Collection of HTML elements. Alias for Dom.collection.
Result of the constraint validation API on form-associated elements.
Canvas object
Document objects
getElementById_opt id returns the element with the id id in the current document. It returns None if there are no such element
getElementById_exn id returns the element with the id id in the current document. It raises if there are no such element
getElementById_coerce id coerce returns the element with the id id in the current document and attempt to coerce it using the provided coerce function. It returns None if there are no such element or if the coerce function returns Js.none. Typical usage is the following:
match Dom_html.getElementById_coerce "myinput" Dom_html.CoerceTo.input with
| None -> ..
| Some input -> ..getElementById id returns the element with the id id in the current document. It raises Not_found if there are no such element
Window objects
Undo manager
Navigator information
Options for Window.postMessage.
Event handlers
see Dom.no_handler
see Dom.handler
see Dom.full_handler
see Dom.listener
see Dom.full_listener
see Dom.invoke_handler
Returns this event related target.
val addEventListenerWithOptions :
(eventTarget 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 :
(eventTarget 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.
Remove the given event listener.
val addMousewheelEventListenerWithOptions :
eventTarget Js.t ->
?capture:bool Js.t ->
?once:bool Js.t ->
?passive:bool Js.t ->
(mouseEvent Js.t -> dx:int -> dy:int -> bool Js.t) ->
event_listener_idAdd a wheel event listener with option-object variant of the addEventListener DOM method. The callback is provided the event and the numbers of ticks the mouse wheel moved. Positive means down / right.
val addMousewheelEventListener :
eventTarget Js.t ->
(mouseEvent Js.t -> dx:int -> dy:int -> bool Js.t) ->
bool Js.t ->
event_listener_idAdd a wheel event listener with the useCapture boolean variant of the addEventListener DOM method. The callback is provided the event and the numbers of ticks the mouse wheel moved. Positive means down / right.
val createCustomEvent :
?bubbles:bool ->
?cancelable:bool ->
?detail:'a ->
'a customEvent Js.t Event.typ ->
'a customEvent Js.tSee Dom.createCustomEvent
Mouse event helper functions
Position helper functions
Returns the absolute position of the mouse pointer.
Position of an element relative to the viewport
Viewport top/left position
Key event helper functions
Use Keyboard_code when you want to identify a key that the user pressed. This should be invoked for keydown and keyup events, not keypress events.
Use Keyboard_key when you want to identify the character that the user typed. This should only be invoked on keypress events, not keydown or keyup events.
Helper functions for creating HTML elements
val createSelect :
?_type:Js.js_string Js.t ->
?name:Js.js_string Js.t ->
document Js.t ->
selectElement Js.tval createInput :
?_type:Js.js_string Js.t ->
?name:Js.js_string Js.t ->
document Js.t ->
inputElement Js.tval createTextarea :
?_type:Js.js_string Js.t ->
?name:Js.js_string Js.t ->
document Js.t ->
textAreaElement Js.tval createButton :
?_type:Js.js_string Js.t ->
?name:Js.js_string Js.t ->
document Js.t ->
buttonElement Js.tCoercion functions
Coercion from a general DOM element to an HTML element. (Unsafe in general.)
type taggedElement = | A of anchorElement Js.t| Area of areaElement Js.t| Audio of audioElement Js.t| Base of baseElement Js.t| Blockquote of quoteElement Js.t| Body of bodyElement Js.t| Br of brElement Js.t| Button of buttonElement Js.t| Canvas of canvasElement Js.t| Caption of tableCaptionElement Js.t| Col of tableColElement Js.t| Colgroup of tableColElement Js.t| Del of modElement Js.t| Dialog of dialogElement Js.t| Div of divElement Js.t| Dl of dListElement Js.t| Embed of embedElement Js.t| Fieldset of fieldSetElement Js.t| Form of formElement Js.t| Frameset of frameSetElement Js.t| Frame of frameElement Js.t| H1 of headingElement Js.t| H2 of headingElement Js.t| H3 of headingElement Js.t| H4 of headingElement Js.t| H5 of headingElement Js.t| H6 of headingElement Js.t| Head of headElement Js.t| Hr of hrElement Js.t| Html of htmlElement Js.t| Iframe of iFrameElement Js.t| Img of imageElement Js.t| Input of inputElement Js.t| Ins of modElement Js.t| Label of labelElement Js.t| Legend of legendElement Js.t| Li of liElement Js.t| Link of linkElement Js.t| Map of mapElement Js.t| Meta of metaElement Js.t| Object of objectElement Js.t| Ol of oListElement Js.t| Optgroup of optGroupElement Js.t| Option of optionElement Js.t| P of paragraphElement Js.t| Param of paramElement Js.t| Pre of preElement Js.t| Q of quoteElement Js.t| Script of scriptElement Js.t| Select of selectElement Js.t| Style of styleElement Js.t| Table of tableElement Js.t| Tbody of tableSectionElement Js.t| Td of tableCellElement Js.t| Textarea of textAreaElement Js.t| Tfoot of tableSectionElement Js.t| Th of tableCellElement Js.t| Thead of tableSectionElement Js.t| Title of titleElement Js.t| Tr of tableRowElement Js.t| Ul of uListElement Js.t| Video of videoElement Js.t| Other of element Js.t
type taggedEvent = | MouseEvent of mouseEvent Js.t| KeyboardEvent of keyboardEvent Js.t| MessageEvent of messageEvent Js.t| MousewheelEvent of mousewheelEvent Js.t| PopStateEvent of popStateEvent Js.t| OtherEvent of event Js.t
Typed access to domStringMap (the type of Element.dataset).
val attachShadow :
?delegatesFocus:bool Js.t ->
mode:Js.js_string Js.t ->
element Js.t ->
shadowRoot Js.tWrapper for Element.attachShadow(init) taking labeled arguments.
val scrollIntoView :
?behavior:Js.js_string Js.t ->
?block:Js.js_string Js.t ->
?inline:Js.js_string Js.t ->
element Js.t ->
unitWrapper for Element.scrollIntoView(options) taking labeled arguments.
Wrapper for HTMLElement.focus(options) taking labeled arguments.
Wrapper for Element.showPopover(options) taking labeled arguments.
Wrapper for Element.togglePopover(options) taking labeled arguments. Returns the new open state.
val postMessage :
?transfer:Js.Unsafe.any Js.js_array Js.t ->
?targetOrigin:Js.js_string Js.t ->
window Js.t ->
'a ->
unitWrapper for window.postMessage(message, options) taking labeled arguments. When ~targetOrigin is omitted, the JavaScript default of "/" (same origin) applies.
val makeScrollToOptions :
?top:Js.number_t ->
?left:Js.number_t ->
?behavior:Js.js_string Js.t ->
unit ->
scrollToOptions Js.tSmart constructor for scrollToOptions.
val makeKeyframeAnimationOptions :
?delay:Js.number_t ->
?endDelay:Js.number_t ->
?fill:Js.js_string Js.t ->
?iterationStart:Js.number_t ->
?iterations:Js.number_t ->
?duration:Js.number_t ->
?direction:Js.js_string Js.t ->
?easing:Js.js_string Js.t ->
?id:Js.js_string Js.t ->
?composite:Js.js_string Js.t ->
?pseudoElement:Js.js_string Js.t Js.opt ->
?timeline:animationTimeline Js.t Js.opt ->
unit ->
keyframeAnimationOptions Js.tSmart constructor for keyframeAnimationOptions.
val makeOptionalEffectTiming :
?delay:Js.number_t ->
?endDelay:Js.number_t ->
?fill:Js.js_string Js.t ->
?iterationStart:Js.number_t ->
?iterations:Js.number_t ->
?duration:Js.number_t ->
?direction:Js.js_string Js.t ->
?easing:Js.js_string Js.t ->
unit ->
optionalEffectTiming Js.tSmart constructor for optionalEffectTiming.
Same as Dom_html.window##setTimeout cb ms but prevents overflow with delay greater than 24 days.
Register a callback to run when the page finishes loading. If the page has already loaded (e.g. when running as WebAssembly), the callback is invoked immediately.
Convert a Dom_html.collection to a Js array
Deprecated function.
Call the appropriate requestAnimationFrame method variant (depending on the navigator), or sleep for a short amount of time when there no such method is provided. We currently prefix the function name with as underscore as the interface of this function is not completely standardized yet. Thus, we leave the room to a function with a possibly refined type.
This function is deprecated. Use the requestAnimationFrame of the window object instead.