Skip to main content

set_text_content

Function set_text_content 

Source
pub fn set_text_content(
    doc: &mut BaseDocument,
    node: NodeId,
    text: &str,
) -> Result<()>
Expand description

node.textContent = text.

On a text or comment node this rewrites the node’s own text. On anything else it replaces the children with a single text node, or with nothing when the text is empty.

Existing children are detached, not dropped, so that wrappers a runtime still holds for them stay valid.