Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Dom.ElementElement node.
Element viewed as a node. All elements are nodes, therefore no conversion is necessary.
val scroll_width : t -> intWidth of the element, including content not visible due to overflow.
It includes padding, but not the border and margins.
val scroll_height : t -> intHeight of the element, including content not visible due to overflow. It includes padding, but not margin and border.
val client_width : t -> intWidth of the visible part of the element with padding, without border and margins.
val client_height : t -> intHeight of the visible part of the element. It includes padding, but not margins, border and scrollbars.
val scroll_left : t -> intNumber of pixels the element's content is scrolled from its left edge.
val scroll_top : t -> intNumber of pixels the element's content is scrolled vertically.
val set_scroll_left : int -> t -> unitset_scroll_left pxs element Set the left scroll position to pxs.
val set_scroll_top : int -> t -> unitset_scroll_top pxs element Set the top scroll position to pxs.
val set_attribute : string -> string -> t -> unitset_attribute name value element Set the attribute name to value on element.
Examples:
set_attribute "id" "my-node" element
set_attribute "class" "my-class" element
set_attribute "href" "https://github.com" element
set_attribute "type" "range" element
set_attribute "type" "password" element
set_attribute "placeholder" "sample-text" elementval remove_attribute : string -> t -> unitremove_attribute name element Remove the attribute name from element.
val set_property : string -> Base.Value.t -> t -> unitset_property name value element Set the property name to value in element.
The distinction between attributes and properties is subtle. Attribute have always a string value and implicitely set the corresponding property as well. A property can have any javascript value and does not set the corresponding attribute, even if the property has a string value.
Examples:
set_property "value" "my-text" input_elementval delete_property : string -> t -> unitdelete_property name element Delete the property name from element.
val focus : t -> unitPut the element into keyboard focus.
val blur : t -> unitUnfocus the element.