html/edit
src/html/edit.tur
innerHTML and outerHTML for edited HTML documents.
Since: 0.2.0
defn
set-inner-html!
(set-inner-html! [el : Node src : cstr] :)
replace an element's children with parsed markup.
Parameters
| el | an HTML element of an HTML Document | |
| src | the markup |
Returns
(Result nil EditError) -- `WrongKind` when `el` is not an HTML element of an HTML Document (an SVG element, say, or anything in an XML one); `BadPlacement` for a void element such as <br> given content.
Example
(set-inner-html! ul "<li>one<li>two") ; two <li> children
Since: 0.2.0
defn
node-inner-html
(node-inner-html [n : Node] :)
the serialized children of a node (innerHTML).
Parameters
| n | the node |
Returns
String -- owned; release it when done.
Example
(to-cstr (node-inner-html p)) ; => "a <b>b</b> c"
Since: 0.2.0
defn
node-outer-html
(node-outer-html [n : Node] :)
the serialized node itself (outerHTML).
Parameters
| n | the node |
Returns
String -- owned; release it when done.
Example
(to-cstr (node-outer-html p)) ; => "<p>a <b>b</b> c</p>"
Since: 0.2.0
Internal definitions
__he-context-ok-- internal: 0 when el is an HTML element of an HTML__he-replace-- internal: put copies of the fragment's top-level nodes in__he-error-- internal: a turdom error code as an EditError.__he-inner-raw-- internal: the children's serializations, concatenated.