Table of contents
Namespace: Com\Tecnick\Pdf\CSS
class ImportanceNormalizer
Source: src/CSS/ImportanceNormalizer.php:34
Propagates !important from a shorthand declaration to all of its longhands.
Methods
getAffectedLonghands()
Return all longhand properties affected by a shorthand, including nested shorthands.
public static getAffectedLonghands(string $property): list<string>
Parameters:
$property(string)
Returns: list<string>
Source: src/CSS/ImportanceNormalizer.php:84
normalize()
Normalize a CSS declaration list to ensure !important is properly applied to all longhands.
When a shorthand property has !important, all its longhands should inherit !important. This ensures consistent precedence across the cascade.
public static normalize(string $declarations): string
Parameters:
$declarations(string): CSS declaration string (e.g., “color: red; border: 1px solid !important;”)
Returns: string: Normalized CSS declaration string with !important propagated to longhands