mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 18:17:22 +02:00
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.
7 lines
272 B
Plaintext
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:
|