Files
ladybird/Tests/LibWeb/Text/expected/css/at-property-add-and-remove.txt
Sam Atkins 960558f30a LibWeb: Register and unregister @property rules when added or removed
Previously, we registered `@property` rules during parsing, and treated
them the same as `CSS.registerProperty()` calls. This is not correct
for a couple of reasons: One, the spec wants us to distinguish between
those two sources of registered custom properties, with
`CSS.registerProperty()` calls taking precedence. Two, we never removed
the registered property when its `@property` was removed from the
document.

This commit deals with this by iterating active CSSPropertyRules to find
which ones currently apply, and storing those in a cache. This cache is
invalidated whenever the Document's style is invalidated, which happens
whenever a CSSRule is added or removed from the Document.

The attached test demonstrates this now working as it should.
2026-01-09 10:54:37 +00:00

7 lines
272 B
Plaintext

Before registering --foo, its value is:
After registering --foo, its value is: "42"
After removing --foo, its value is:
Before adding the new sheet, --bar's value is:
After adding the new sheet, --bar's value is: "1337"
After removing the new sheet, --bar's value is: