Skip to main content

Module html

Module html 

Source
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.