package brr

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

DOM element attributes.

Attributes

type name = Jstr.t

The type for attribute names.

type t

The type for attributes.

val v : name -> Jstr.t -> t

v n value is an attribute named n with value value.

val void : t

void is an attribute that doesn't exist. It is ignored by functions like El.v. This is v Jstr.empty Jstr.empty.

val is_void : t -> bool

is_void a is true iff a is void.

val true' : name -> t

true' n is v n Jstr.empty. This sets the boolean attribute n to true. The attribute must be omitted to be false.

val int : name -> int -> t

int n i is v n (Jstr.of_int i).

val float : name -> float -> t

float n f is v n (Jstr.of_float f).

val if' : bool -> t -> t

if' b a is a if b is true and void otherwise.

val if_some : t option -> t

if_some o is a if o is Some a and void if o is None.

val to_pair : t -> Jstr.t * Jstr.t

to_pair at is (n,v) the name and value of the attribute.

val add_if : bool -> t -> t list -> t list

add_if c att atts is att :: atts if c is true and atts otherwise.

  • deprecated use Brr.At.if' instead.
val add_if_some : name -> Jstr.t option -> t list -> t list

add_if_some n o atts is (v n value) :: atts if o is Some value and atts otherwise.

  • deprecated use Brr.At.if_some instead.

Attribute names and constructors

See the MDN HTML attribute reference.

Convention. Whenever an attribute name conflicts with an OCaml keyword we prime it, see for example class'.

module Name : sig ... end

Attribute names.

type 'a cons = 'a -> t

The type for attribute constructors with value of type 'a.

val accesskey : Jstr.t cons
val action : Jstr.t cons
val autocomplete : Jstr.t cons
val autofocus : t
val charset : Jstr.t cons
val checked : t
val class' : Jstr.t cons
val cols : int cons
val content : Jstr.t cons
val contenteditable : bool cons
val defer : t
val dir : Jstr.t cons
val disabled : t
val draggable : bool cons
val for' : Jstr.t cons
val height : int cons
val hidden : t
val href : Jstr.t cons
val id : Jstr.t cons
val lang : Jstr.t cons
val list : Jstr.t cons
val media : Jstr.t cons
val method' : Jstr.t cons
val name : Jstr.t cons
val placeholder : Jstr.t cons
val rel : Jstr.t cons
val required : t
val rows : int cons
val selected : t
val spellcheck : Jstr.t cons
val src : Jstr.t cons
val style : Jstr.t cons
val tabindex : int cons
val title : Jstr.t cons
val type' : Jstr.t cons
val value : Jstr.t cons
val wrap : Jstr.t cons
val width : int cons
OCaml

Innovation. Community. Security.