Module B00_htmlg.At

Attributes.

Attributes

type name = string

The type for attribute names.

type t

The type for attributes.

val v : name -> string -> t

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

val v_true : name -> t

v_true n is v n "", the boolean attribute n set to true (the attribute must be omitted to be false).

val v_int : name -> int -> t

v_int n i is v n (string_of_int i).

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

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

val add_some : name -> string option -> t list -> t list

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

Predefined attribute constructors

See the MDN HTML attribute reference.

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

type 'a cons = 'a -> t

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

val autofocus : t

autofocus

val charset : string cons

charset

val checked : t

checked

val class' : string cons

class

val content : string cons

content

val defer : t

defer

val disabled : t

disabled

val for' : string cons

for'

val height : int cons

height

val href : string cons

href

val id : string cons

id

val lang : string cons

lang

val media : string cons

media

val name : string cons

name

val placeholder : string cons

placeholder

val rel : string cons

rel

val src : string cons

src

val tabindex : int cons

tabindex

val title : string cons

title

val type' : string cons

type

val value : string cons

value

val width : int cons

width