Html
Build HTML content.
See the MDN HTML attribute reference.
val attr : string -> string -> attr
attr name v
is an attribute name
with value v
.
val autocomplete : string -> attr
See autocomplete.
val contenteditable : bool -> attr
See contenteditable.
val formaction : string -> attr
See formaction.
See hidden.
val placeholder : string -> attr
See placeholder.
val spellcheck : string -> attr
See spellcheck.
val class_list : string list -> attr
class_list list
is similar to class_name
but accepts a list of class names.
val class_flags : (string * bool) list -> attr
class_flags list
is similar to class_list
, but can conditionally omit class names depending on the boolean values in list
.
val role : string -> attr
val style_list : (string * string) list -> attr
val value_or : string -> string option -> attr
val on :
?default:bool ->
?confirm:string ->
Stdweb.Dom.Event.name ->
(Stdweb.Dom.event -> unit) ->
attr
on ?default ?confirm event_name handler
register an event handler
for an event called event_name
.
Passing ~default:false
is equivalent to calling preventDefault()
in JavaScript.
~confirm:msg
will only run handler
if the user comfirms a browser prompt with message msg
.
val on_change : ?confirm:string -> (string -> unit) -> attr
on_change ?confirm handler
reacts to the change
event. Passes event.target.value
to handler
when triggered.
val on_checked : ?confirm:string -> (bool -> unit) -> attr
on_checked ?confirm handler
reacts to the change
event. Passes event.target.checked
to handler
when triggered.
val on_input : ?confirm:string -> (string -> unit) -> attr
on_input ?confirm handler
reacts to the input
event. Passes event.target.value
to handler
when triggered.
val on_click : ?confirm:string -> (unit -> unit) -> attr
on_click ?confirm handler
reacts to the click
event.
val on_double_click : ?confirm:string -> (unit -> unit) -> attr
on_double_click ?confirm handler
reacts to the dblclick
event.
module Attr : sig ... end
Additional attribute operations.
elem name attrs children
is an HTML element named name
with attributes attr
and children
.
val empty : html
empty
is an empty element that will not be rendered.
val text : string -> html
text s
is character data s
. s
will be escaped.
val int : int -> html
int n
is text (string_of_int n)
.
val nbsp : html
nbsp
is text "\u{00A0}"
.
See DocumentFragment
.
See blockquote.
See caption.
See figcaption.
See footer.
See html.
See menu.
See nav.
val text_list : string list -> html
module Elem : sig ... end
Additional element operations.
val mount : Stdweb.Dom.node -> html -> unit