package cascade
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=1cf5079b3797cd6e70fbced8dc2631074f357d36fcdea8597c7ba17ac2903f6e
sha512=43f5e6a3986f8f43ce948b8f1d59f6f00e1047f5707c5449b6323b683d2ecd51a0fb34793aad9c48904a67b0f7268d7379ab9baf29917c25a962064bfa3ab694
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.