ladybird/Tests/LibWeb/Text/input/css/getComputedStyle-pseudo-element.html
Sam Atkins 14611de362 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. :^)
2024-08-07 16:14:49 +02:00

32 lines
879 B
HTML

<!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>