LadybirdBrowser / ladybird

Truly independent web browser
https://ladybird.org
BSD 2-Clause "Simplified" License
21.21k stars 921 forks source link

CSS vars set in the style attribute via JS appears to not be preserved. #1712

Open Ampflower opened 1 week ago

Ampflower commented 1 week ago

Relevant section of code:

https://github.com/Ampflower/ampflower.gay/blob/951fbd1e764a14e767070c9903ea7e017d1a3de4/src/assets/js/hibiscus.js#L63-L66

It is notable that inspect element can override it and preserve it perfectly fine, telling me this is likely a JS API problem and not a CSS or DOM problem.

AtkinsSJ commented 1 week ago

I think this is the relevant code:

https://github.com/LadybirdBrowser/ladybird/blob/e40ad73ae79023f64e250f854d0730c21e0f54fc/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.cpp#L291-L297

CSS variables (technical term "custom properties") will return nothing from property_id_from_string() so it's not doing anything.

A rough idea of what needs changing: