Page
Library
Module
Module type
Parameter
Class
Class type
Source
Fmlib_browser.HtmlSourceVirtual Dom
A node of the virtual dom represents a node in the dom of the browser. Basically there are text nodes and element nodes.
Note that there are many, many, many specific elements and many, many specific attributes . I.e. if you write a function like
    let view ... =
        let open Html in
        let open Attribute in
        div [] [
            h1 [] [text "Chapter 1"];
            p  [] [text "...."];
            ...
        ]some of the attribute names and html node names might shadow function arguments or other local names in your module. Furthermore there are nodes with the same name as an attribute (e.g. label). The name clash might not be immediately visible because the OCaml compiler complains about some type error.
In order to avoid a lot of typing by not opening the namespaces it might be recommendable to write the above function in the following style
    let view ... =
        let module H = Html in
        let module A = Attribute in
        H.div [] [
            H.h1 [] [text "Chapter 1"];
            H.p  [] [text "...."];
            ...
        ]Type of a virtual dom node potentially generating a message of type 'msg.
node tag attrs children
Create an html element with a tagname, a list of attributes and a list of children.
node namespace tag attrs children
Like node, but creates the node within a namespace e.g. "http://www.w3.org/2000/svg" for svg elements.
svg_node tag attrs children
Create an svg element with a tagname, a list of attributes and a list of children. An svg element is a node in the namespace "http://www.w3.org/2000/svg".
map f vdom
Map a virtual dom vdom creating messages of type 'a to a virtual dom creating messages of type 'b.
keyed tag attrs children
Like node, but add a unique identifier to each child node. This makes adding, removing and modifying child nodes more efficient. The dom diffing algorithm compares child nodes with the same identifier.
Reference nodes are nodes whose content is not controlled by the virtual dom. In the virtual dom the reference nodes are inserted by their name.
The contents of reference nodes is controlled via Command.set_reference.
Reference nodes are persistent. Once referenced by reference or initialized or updated by Command.set_reference they exist. Once existing they can be modidfied by Command.set_reference.
The virtual dom can use them or not. They remain in existence.
Reference nodes are a means to improve performance. In the following examples reference nodes might be useful:
address attrs children
Defines a section containing contact information about a person or organization.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/address
article attrs children
Defines self-contained content, which is usable independently of the page. Examples include blog posts, user-submitted comments or interactive widgets.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/article
aside attrs children
Defines content that is not directly related to the main content of the page. This content is often presented as a sidebar or a call-out box.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/aside
footer attrs children
Defines the footer for a page or section. It typically contains information about the author, copyright data, or links to related documents.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/footer
header attrs children
Defines the header of a page or section. It typically contains a logo, the title of the page and navigation elements.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/header
h1 attrs children
Defines a section heading. <h1> is the highest section level and <h6> is the lowest.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/Heading_Elements
h2 attrs children
Defines a section heading. h1 is the highest section level and h6 is the lowest.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/Heading_Elements
h3 attrs children
Defines a section heading. h1 is the highest section level and h6 is the lowest.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/Heading_Elements
h4 attrs children
Defines a section heading. h1 is the highest section level and h6 is the lowest.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/Heading_Elements
h5 attrs children
Defines a section heading. h1 is the highest section level and h6 is the lowest.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/Heading_Elements
h6 attrs children
Defines a section heading. h1 is the highest section level and h6 is the lowest.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/Heading_Elements
hgroup attrs children
Represents a heading grouped with any secondary content, such as subheadings, an alternative title, or a tagline.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/hgroup
main attrs children
Defines the main or most important content of the page. There can be only one main element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/main
nav attrs children
Represents a section that provides navigation links.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/nav
section attrs children
Represents a generic section of a document. Use this if the content cannot be represented by a more specific semantic element. A section should have a heading.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/section
search attrs children
Represents a section that contains controls for performing a search or filtering operation.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/search
blockquote attrs children
Represents a block of quoted text. The cite attribute allows specifying a source URL and the title of the source can be given using the cite element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/blockquote
dd attrs children
Provides the definition or description of the dt element listed before it.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dd
dt attrs children
Represents a term which is defined / described by the subsequent dd element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dt
figcaption attrs children
Represents the caption or legend of a figure.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/figcaption
figure attrs children
Defines a figure which contains some content and a figcaption. Examples for suitable content are pictures, diagrams, quotes or code snippets.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/figure
hr attrs children
Represents a thematic break between paragraphs.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/hr
li attrs children
Defines an item of an ordered or unordered list.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/li
menu attrs children
Represents a list of menu entries, such as navigation links or buttons. This can be used as a semantic alternative to ol.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/menu
ol attrs children
Represents an ordered list of items.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/ol
p attrs children
Represents a text paragraph.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/p
pre attrs children
Represents preformatted text which is to be presented exactly as written.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/pre
ul attrs children
Defines an unordered list of items.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/ul
a attrs children
Represents a hyperlink.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/a
abbr attrs children
Represents an abbreviation or an acronym. The title attribute allows specifying the full expansion for the abbreviation.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/abbr
b attrs children
Used to draw the reader's attention to the element's contents. This is not meant to indicate special importance. Use strong for that instead.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/b
bdi attrs children
Represents text that should be treated in isolation from its surrounding when it comes to text directionality. This allows embedding text snippets with a different or unknown directionality.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/bdi
bdo attrs children
Overrides the current directionality of text using the dir attribute, so that the text within is rendered in a different direction.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/bdo
br attrs children
Produces a line break.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/br
cite attrs children
Represents the title of a cited work.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/cite
code attrs children
Represents a piece of computer code.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/code
data attrs children
Links a piece of content with a machine-readable representation (specified in the value attribute).
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/data
dfn attrs children
Represents a term that is defined in the surrounding element. If it has an id attribute, it can be linked to with an a element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dfn
em attrs children
Marks text as emphasized, e.g. to signal that a world should be stressed. Typically the text is rendered in italic.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/em
i attrs children
Represents a range of text that is set off from the normal text. Possible reasons for that are that the text should be read in different voice or it is a technical term or a term from another language. Typically the text is rendered in italic.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/i
kbd attrs children
Represents the textual representation of some user input, such as a keyboard shortcut.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/kbd
mark attrs children
Represents text that is marked or highlighted due to its relevance in the enclosing context.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/mark
q attrs children
Represents a short inline quotation.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/q
rp attrs children
Used to provide fall-back parentheses for browsers that do not support the display of ruby annotations using the ruby element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/rp
rt attrs children
Specifies the ruby text component of a ruby annotation.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/rt
ruby attrs children
Represents small annotations that are rendered above, below, or next to base text, usually used for showing the pronunciation of East Asian characters.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/ruby
s attrs children
Represent text that is no longer relevant or no longer accurate.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/s
samp attrs children
Allows embedding the output of a computer program as inline text.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/samp
small attrs children
Represents side-comments and small print, like copyright notices and legal text.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/small
strong attrs children
Represents important text. Typically it is rendered with a bold font.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/strong
sub attrs children
Defines text that should be displayed as subscript.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/sub
sup attrs children
Defines text that should be displayed as superscript.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/sup
time attrs children
Represents a data and time value. The datetime attribute allows specifying this value in a machine-readable format.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/time
u attrs children
Defines text that should be rendered with a non-textual annotation. Typically the text is rendered with an underline.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/u
var attrs children
Represents the name of a variable in a mathematical expression or a programming context.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/var
wbr attrs children
Marks a position within a word where the browser may optionally insert a line break. Can be used when the standard line-breaking rules don't yield the desired outcome.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/wbr
area attrs children
Defines an area inside an image map that has predefined clickable areas.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/area
audio attrs children
Used to embed sound content in documents.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/audio
img attrs children
Embeds an image into the document.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/img
map_ attrs children
Defines an image map which is an image with several clickable areas.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/map
video attrs children
Embeds a media player which supports video playback into the document.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/video
embed attrs children
Embeds external content, provided by an external application, into the document.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/embed
fencedframe attrs children
Represents a nested browsing context, like iframe but with more native privacy features built in.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/fencedframe
iframe attrs children
Represents a nested browsing context, embedding another HTML page into the current one.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe
object_ attrs children
Represents an external resource, which can be treated as an image, a nested browsing context, or a resource to be handled by a plugin.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/object
picture attrs children
Contains zero or more <source> elements and one <img> element to offer alternative versions of an image for different display/device scenarios.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/picture
canvas attrs children
Allows drawing graphics and animations using the canvas API or the WebGL API.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/canvas
del attrs children
Represents a range of text that has been removed from the document.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/del
ins attrs children
Represents a range of text that has been added to the document.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/ins
caption attrs children
Specifies the title of a table.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/caption
col attrs children
Defines one or more columns in a column group.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/col
colgroup attrs children
Defines a group of columns within a table.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/colgroup
table attrs children
Represents tabular data, that is data in two dimensions.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/table
tobdy attrs children
Defines the set of table rows containing the table's main data.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/tobdy
td attrs children
Defines a data cell of a table.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/td
tfoot attrs children
Defines the set of table rows, located at the bottom of the table, containing summaries about the table's columns.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/tfoot
th attrs children
Defines a header cell for one or more data cells.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/th
thead attrs children
Defines the set of table rows, located at the top of the table, containing the titles of the table's columns.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/thead
tr attrs children
Defines a row of a table.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/tr
button attrs children
Defines a button.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/button
datalist attrs children
Pre-defines a list of options for use in other input controls.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/datalist
fieldset attrs children
Used to group several controls and labels within a form.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/fieldset
form attrs children
Represents a section containing user input controls and a submit button. Allows submitting user input to the server.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/form
input attrs children
Allows a wide variety of user input, e.g. text, numbers, colors, date and time.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input
label attrs children
Specifies a caption for another element. This is often used to describe user input elements.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/label
legend attrs children
Represents a caption for the content of a fieldset.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/legend
meter attrs children
Represents either a scalar value or fractional value within a known range.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/meter
output attrs children
A container for displaying the results of a calculation.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/output
progress attrs children
Displays an indicator showing the completion progress of a task.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/progress
select attrs children
Represents a control that allows selecting out of multiple options.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/select
textarea attrs children
Represents a multi-line text editing control.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/textarea
details attrs children
Represents a widget that the user can click to reveal additional information. A short summary of the contents must be provided in a summary element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/details
dialog attrs children
Represents a dialog box or other interactive component, such as a dismissible alert, inspector, or subwindow.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dialog
summary attrs children
Provides a summary of the information hidden in a details element. Clicking the summary will toggle the "open" state of the details element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/summary