Legend:
Library
Module
Module type
Parameter
Class
Class type
DOM elements.
The type El.t technically represents DOM Node objects. However most of DOM processing happens on elements. So we make it as if El.t values were just elements and most of the functions of this module will fail on text nodes. Except on children where you may see them you'll likely never run into problems. The is_txt function can be used to check for textiness.
The type for elements. Technically this is a DOM Node object. But we focus on DOM manipulation via elements, not the various kind of nodes that may exist.
v ?d ?at name cs is an element name with attribute at (defaults to []) and children cs. If at specifies an attribute more thanonce, the last one takes over with the exception of At.class' whose occurences accumulate to define the final value. d is the document on which the element is defined it defaults Brr.G.document.
txt s is the text s. d is the document on which the element is defined it defaults Brr.G.document. WARNING This is not strictly speaking an element most function of this module will error with this value.
set_at a v e sets the attribute a of e to v. If v is None the attribute is removed.
Some attributes are reflected as JavaScript properties in elements see here for details. The following gives a quick way of accessing these properties for elements whose interface which, unlike Brr_canvas.Canvas and Brr_io.Media.El, are not necessarily bound by Brr for the time being (or will never be).
inline_style p e is the inline style property p of e.
val set_inline_style : ?important:bool ->Style.prop->Jstr.t->t-> unit
set_inline_style ~important p v e sets the inline style property p of e to v with priority important (defaults to false).
Layout
The inner bound of an element includes its content and padding but not its border. We use the client* properties to get it. These only have integral CSS pixel precision.
scroll_h e is the minimum height the element would require to display without a vertical scrollbar.
val scroll_into_view : ?align_v:[ `Start | `End ]->t-> unit
scroll_into_view ~align escrollse into view. If align_v is `Start (default) the top of the element is align with to to the top of the scrollable area. If align_v is `End the bottom of the element is aligned with the bottom of the scrollable area.
request_pointer_lock e requests the pointer to be locked to e in the document it belongs to. This listens on the document for the next Ev.pointerlockchange and Ev.pointerlockerror to resolve the future appropriately.
select_text e selects the textual contents of e. If the DOM element e has no select method this does nothing.
Element interfaces
Some interfaces are in other modules. See for example Brr_io.Media.El for the media element interface and Brr_canvas.Canvas for the Canvas Element interface.