mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 17:55:07 +02:00
LibWeb: Implement getComputedStyle() pseudoElement parameter
Right now, we deviate from the CSSOM spec regarding our CSSStyleDeclaration classes, so this is not as close to the spec as I'd like. But it works, which means we'll be able to test pseudo-element styling a lot more easily. :^)
This commit is contained in:
committed by
Andreas Kling
parent
dae9c9be40
commit
14611de362
Notes:
github-actions[bot]
2024-08-07 14:15:51 +00:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/14611de362d Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/994
@@ -0,0 +1,32 @@
|
||||
<!DOCTYPE html>
|
||||
<script src="../include.js"></script>
|
||||
<style>
|
||||
#foo {
|
||||
color: grey;
|
||||
background-color: yellow;
|
||||
}
|
||||
#foo::before {
|
||||
content: "hi";
|
||||
background-color: cyan;
|
||||
}
|
||||
</style>
|
||||
<div id="foo"></div>
|
||||
<script>
|
||||
test(() => {
|
||||
const foo = document.getElementById("foo");
|
||||
const style = getComputedStyle(foo);
|
||||
const beforeStyle = getComputedStyle(foo, "::before");
|
||||
const propertyValues = [
|
||||
"color",
|
||||
"background-color",
|
||||
];
|
||||
println("#foo:");
|
||||
for (const property of propertyValues) {
|
||||
println(` ${property}: ${style.getPropertyValue(property)}`);
|
||||
}
|
||||
println("#foo::before:");
|
||||
for (const property of propertyValues) {
|
||||
println(` ${property}: ${beforeStyle.getPropertyValue(property)}`);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user