mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-30 06:06:48 +00:00
LibWeb: Invalidate element with CSS custom props on attribute changes
Element styles should be invalidated when they depend on CSS variables defined in one of their ancesors or when one of their ancestors change their class, due to the possibility of adding new CSS variables in scope.
This commit is contained in:
parent
8e1ecd25ae
commit
fa950a5727
Notes:
github-actions[bot]
2025-03-13 18:21:38 +00:00
Author: https://github.com/kmruiz 🔰
Commit: fa950a5727
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3853
Reviewed-by: https://github.com/kalenikaliaksandr ✅
3 changed files with 41 additions and 0 deletions
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="./include.js"></script>
|
||||
<style>
|
||||
body {
|
||||
--color: red;
|
||||
}
|
||||
body.green {
|
||||
--color: green;
|
||||
}
|
||||
</style>
|
||||
<body></body>
|
||||
<script>
|
||||
test(() => {
|
||||
const div = document.createElement('div');
|
||||
document.body.appendChild(div);
|
||||
|
||||
div.style["backgroundColor"] = "var(--color)";
|
||||
div.style["width"] = "100px";
|
||||
div.style["height"] = "100px";
|
||||
|
||||
const bgColorBefore = getComputedStyle(div).backgroundColor;
|
||||
|
||||
document.body.className = "green";
|
||||
const bgColorAfter = getComputedStyle(div).backgroundColor;
|
||||
|
||||
println(bgColorBefore);
|
||||
println(bgColorAfter);
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue