Skip to main content

normalize_attributes

Normalizes a list of attribute name-value pairs by sorting class names alphabetically and standardizing boolean attributes to ensure consistent DOM comparisons.

def normalize_attributes(
attributes: iterable
) - > list

Standardizes HTML attribute values to ensure consistent comparisons between DOM instances, specifically handling class ordering and boolean attribute shorthand.

Parameters

NameTypeDescription
attributesiterableA collection of name-value pairs representing HTML attributes to be processed.

Returns

TypeDescription
listA list of tuples containing the normalized attribute names and their standardized values.