Expand description
Injecting Livewire’s wire attributes into rendered component HTML.
A component’s view renders one root element. The framework adds wire:id, wire:name,
wire:snapshot, and wire:effects to that element’s start tag, right after the tag name,
leaving every other byte of the rendered document untouched. Upstream does that with a regular
expression and substr_replace; here the element is located with lol_html, which understands
comments, doctypes, and raw-text elements, and the attributes are spliced in at the byte the
scanner reports.
Functions§
- count_
root_ elements - Counts the top-level elements in rendered component HTML.
- escape_
attribute - Escapes a value for a double-quoted HTML attribute.
- insert_
attributes - Inserts the attributes into the first element of
html.