pub fn insert_attributes(
html: &str,
attributes: &[(String, String)],
) -> Result<String, LivewireError>Expand description
Inserts the attributes into the first element of html.
The attributes go right after the tag name, so <div class="a"> becomes
<div wire:id="x" class="a">. Nothing else in the document is rewritten: attribute quoting,
whitespace, comments, script bodies, and self-closing forms keep their exact bytes.
Values are escaped with escape_attribute. Attribute names are written verbatim.
ยงErrors
Returns LivewireError::RootTagMissing when the document contains no element at all, and
LivewireError::MalformedPayload when the HTML scanner rejects the document.