jon.recoil.org

Module Brr.At

DOM element attributes.

Attributes

type name = Jstr.t

The type for attribute names.

type t

The type for attributes.

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

val void : Brr.At.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 : Brr.At.t -> bool

is_void a is true iff a is void.

val true' : Brr.At.name -> Brr.At.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 : Brr.At.name -> int -> Brr.At.t

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

val float : Brr.At.name -> float -> Brr.At.t

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

val if' : bool -> Brr.At.t -> Brr.At.t

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

val if_some : Brr.At.t option -> Brr.At.t

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

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

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

val add_if : bool -> Brr.At.t -> Brr.At.t list -> Brr.At.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 : Brr.At.name -> Jstr.t option -> Brr.At.t list -> Brr.At.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 -> Brr.At.t

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

val autocomplete : Jstr.t Brr.At.cons
val autofocus : Brr.At.t
val checked : Brr.At.t
val cols : int Brr.At.cons
val contenteditable : bool Brr.At.cons
val defer : Brr.At.t
val disabled : Brr.At.t
val height : int Brr.At.cons
val hidden : Brr.At.t
val method' : Jstr.t Brr.At.cons
val placeholder : Jstr.t Brr.At.cons
val required : Brr.At.t
val rows : int Brr.At.cons
val selected : Brr.At.t
val spellcheck : Jstr.t Brr.At.cons
val tabindex : int Brr.At.cons
val width : int Brr.At.cons