package cascade
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=3315f94068943b3655bf530c1d82b68655524ff3601efedfbaf0a7f886fbf5a1
sha512=0f187c8e17fcbddaa0ad2760930956451062e476b678e1e60daf6ad9e7414fad99a2d70534dfdf8bca0a1092e374d009051f06b0ce9da33f2742cdde0187e75c
doc/cascade.html/Cascade_html/Html/index.html
Module Cascade_html.HtmlSource
A mutable HTML tree, parsed and printed with markup.ml.
Cascade.Resolve needs a tree with parent links and settable attributes; markup.ml gives a signal stream. This is the tree in between, and it holds every node HTML has, comments included: <p>v<!-- -->4.3</p> keeps two text nodes, and a browser measures the two apart, so dropping the comment changes the render. Licence headers and conditional comments are the other reason they are content, not decoration.
parse html is the document html denotes: the top-level nodes the parser leaves, in order - a doctype, any comment outside the markup, and the elements themselves. The <html> wrapper is among them only when the source wrote that tag or a doctype, so <p>hi</p> parses to the <p> alone and a source carrying no element at all leaves roots empty.
find_all tag doc is every tag element in doc, in document order.
roots doc is the elements among doc's top-level nodes, the trees to resolve against.
attribute e name is the value of e's name attribute, or None.
set_attribute e name value sets e's name attribute.
classes e is the class names in e's class attribute (HTML sec. 2.4.7: a set of space-separated tokens splits on ASCII whitespace).
element_children e is e's child elements, in document order.
text_children e is the data of e's direct child text nodes. A comment is not one: it does not stop an element being :empty.
element tag ~text is a new HTML element named tag holding text.
append_child parent child adds child as parent's last child.