package virtual_dom

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type element = {
  1. tag_name : string;
  2. attributes : (string * string) list;
  3. string_properties : (string * string) list;
  4. bool_properties : (string * bool) list;
  5. styles : (string * string) list;
  6. handlers : (string * Handler.t) list;
  7. hooks : (string * Virtual_dom.Vdom.Attr.Hooks.For_testing.Extra.t) list;
  8. key : string option;
  9. children : t list;
}
and t =
  1. | Text of string
  2. | Element of element
  3. | Widget

Roughly analogous to Vdom.Node.t, but more easily inspectable and represented as a pure OCaml type.

val sexp_of_element : element -> Sexplib0.Sexp.t
val sexp_of_t : t -> Sexplib0.Sexp.t
val map : t -> f:(t -> [ `Continue | `Replace_with of t ]) -> t
val is_tag : tag:string -> t -> bool
val has_class : cls:string -> t -> bool
val select : t -> selector:string -> t list
val select_first : t -> selector:string -> t option
val select_first_exn : t -> selector:string -> t
val to_string_html : ?filter_printed_attributes:(key:string -> data:string -> bool) -> ?censor_paths:bool -> ?censor_hash:bool -> ?path_censoring_message:string -> ?hash_censoring_message:string -> t -> string
val inner_text : t -> string
val unsafe_convert_exn : Virtual_dom.Vdom.Node.t -> t
val trigger : ?extra_fields:(string * Js_of_ocaml.Js.Unsafe.any) list -> t -> event_name:string -> unit
val trigger_hook : t -> type_id:'t Core.Type_equal.Id.t -> name:string -> f:('t -> 'a -> unit Virtual_dom.Vdom.Effect.t) -> arg:'a -> unit

When a hook-based attribute build from an event-returning function, this function will find the hook, extract the value, call that function with arg, and schedule the resulting function.

val get_hook_value : t -> type_id:'a Core.Type_equal.Id.t -> name:string -> 'a

Given an element, this function attempts to retrieve a hook with the name name, and the type-id from the hooks For_testing module.

module User_actions : sig ... end

Convenience functions for trigger, closely modeling user interactions.

OCaml

Innovation. Community. Security.