package fmlib_js

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type t

Document type.

val title : t -> string

The title of the document.

val set_title : string -> t -> unit

set_title str doc Set the title of the document.

val body : t -> Element.t

The body of the document.

Precondition: The document must have been loaded!

Never call this function before the page has been loaded.

val find : string -> t -> Element.t option

find id doc Find the element with the id attribute id in the document doc. Uses the javascript method getElementById.

val create_element : string -> t -> Element.t

create_element tag doc Create a new element with tag.

val create_text_node : string -> t -> Node.t

create_text_node text doc Create a new text node with content text.

val create_element_ns : string -> string -> t -> Element.t

create_element_ns namespace name doc

Like create_element, but creates the element within a namespace, e.g. "http://www.w3.org/2000/svg".

val create_document_fragment : t -> Node.t

Create a new document fragment.

A document fragment is a special node with no parent. Adding children to the fragment does not affect the dom i.e. does not cause reflow and repaint, because the fragment is not part of the active dom.

If you call

node.append(fragment)

all the children the fragment are appended to node instead of the fragment, leaving an empty fragment behind.

OCaml

Innovation. Community. Security.