Dom.NodeA node in the dom tree.
val event_target : t -> Event_target.tThe node viewed as an event target.
apppend child parent Append child to the end of the children of parent
If child is already a child of another node, it is removed from the other node. A node can be a child of only one parent node.
remove child parent Remove child from parent
Precondition: child must be a child of parent.
If you are not sure that child belongs to parent, get parent child and check (by physical equality ==) that the computed parent and parent are the same.
Procedure to remove all children from a node:
let rec remove_children (node: t): unit =
match first node with
| None ->
()
| Some child ->
remove child node;
remove_children node (* tail recursion, compiled to a
javascript loop. *)replace new_child old_child parent
Put new_child at the position of old_child within parent which is the parent of old_child.
Precondition: old_child must be a child of parent.
val remove_children : t -> unitremove_children parent Remove all children from parent.
val node_value : t -> stringThe value of the node. The text for text nodes.
val set_node_value : string -> t -> unitSet the node value.