Skip to main content

data

Function data 

Source
pub fn data(doc: &BaseDocument, node: NodeId) -> Result<Option<String>>
Expand description

characterData.data.

None is the DOM’s null, which is what a node with no character data returns. A comment reports its contents, as CharacterData requires.

That last part was a bug in the fork until this crate was written. The contents were on the node all along (NodeData::Comment { contents }), and clone_node copied them, but the accessor returned "" and the mutator dropped writes on the floor, so a script could clone a comment and read back text the original refused to report. Fixed across all three sites in one change, blitz-script included, so reparenting is still behaviour-preserving. See MAPPING.md.