Module Virtual_dom__.Node
module Element : sig ... endThe values associated with an Element and element like nodes. (that is in practice all nodes that aren't just text).
type t=|None|Text of Base.string|Element of Element.t|Widget of Widget.ttype node_creator= ?key:Base.string -> Virtual_dom__.Attr.t Base.list -> t Base.list -> ttype node_creator_childless= ?key:Base.string -> Virtual_dom__.Attr.t Base.list -> t
val none : tval text : Base.string -> tval textf : ('a, Base.unit, Base.string, t) Base.format4 -> 'aval a : node_creatorval body : node_creatorval button : node_creatorval code : node_creatorval div : node_creatorval h1 : node_creatorval h2 : node_creatorval h3 : node_creatorval h4 : node_creatorval h5 : node_creatorval h6 : node_creatorval header : node_creatorval html : node_creatorval input : node_creatorval textarea : node_creatorval select : node_creatorval option : node_creatorval label : node_creatorval li : node_creatorval p : node_creatorval pre : node_creatorval section : node_creatorval span : node_creatorval strong : node_creatorval table : node_creatorval tbody : node_creatorval td : node_creatorval th : node_creatorval thead : node_creatorval tr : node_creatorval ul : node_creatorval ol : node_creatorval br : node_creator_childlessval hr : node_creator_childlessval create : Base.string -> ?key:Base.string -> Virtual_dom__.Attr.t Base.list -> t Base.list -> tkeyis used by Virtual_dom as a hint during diffing/patching
val create_svg : Base.string -> ?key:Base.string -> Virtual_dom__.Attr.t Base.list -> t Base.list -> tLike
createbut for svg nodes (i.e. all to be placed inside <svg> tag). This is needed as browsers maintain separate namespaces for html and svg, and failing to use the correct one may result in delayed redraws.
val to_dom : t -> Js_of_ocaml.Dom_html.element Js_of_ocaml.Js.tval unsafe_to_js : t -> Js_of_ocaml.Js.Unsafe.anyval widget : ?destroy:('s -> Js_of_ocaml.Dom_html.#element as 'e Js_of_ocaml.Js.t -> Base.unit) -> ?update:('s -> 'e Js_of_ocaml.Js.t -> 's * 'e Js_of_ocaml.Js.t) -> id:('s * 'e Js_of_ocaml.Js.t) Base.Type_equal.Id.t -> init:(Base.unit -> 's * 'e Js_of_ocaml.Js.t) -> Base.unit -> tCreates a Node.t that has fine-grained control over the Browser DOM node.
Callbacks =========
init: Returns a Browser DOM Node and a widget state object. The Browser DOM node is mounted into the dom in the location where the Node.t object would otherwise be.
update: Given the previous Browser DOM Node and state, makes any changes necessary to either and returns a new state and Browser DOM Node.
destroy: Called when this Node.t is removed from the Virtual_dom. Performs any necessary cleanup.
Other =====
The
idis used to compare widgets, and is used to make sure that the state from one widget doesn't get interpreted as the state for another. Otherwise, you would be able to implement Obj.magic using this API.WARNING: While other Virtual_dom APIs shield the application from script injection attacks, the
Widget.createfunction allows a developer to bypass these safeguards and manually create DOM nodes which could allow an attacker to change the behavior of the application or exfiltrate data.In using this API, you are being trusted to understand and follow security best-practices.
module Patch : sig ... end