Skip to main content

Module util

Module util 

Source
Expand description

Internal helpers shared across audit gates.

Provides a quote-aware HTML tag end-detector (so SVG data URLs and ?…&… query strings inside src / href attributes do not truncate tags) plus a small attribute extractor that mirrors accessibility::extract_attr_value’s behaviour.

Functions§

find_tag_end
Returns the absolute end index (one past the closing >) of the HTML tag that starts at tag_start. Skips > characters inside quoted attribute values (single and double quotes).
hreflang_attr
Reads a single attribute value out of a tag.
strip_script_and_style
Returns a copy of html with the contents of every <script> and <style> element blanked to spaces (byte offsets are preserved; newlines survive so line-based diagnostics stay stable).