Files
ladybird/Tests/LibWeb/Text/input/css/insert-rule-quoted-keyframes-invalidation.html
Andreas Kling e4800b2498 LibWeb: Parse @keyframes name as logical string, not token text
The @keyframes parser was storing the keyframes name via
Token::to_string(), which keeps a string token in its quoted,
serialized form. That meant @keyframes "foo" was stored as
"\"foo\"" while animation-name: "foo" resolved to "foo",
and the two never matched.

Store the unquoted string or identifier value so the @keyframes name
and the animation-name reference compare on the same string.
2026-04-22 20:59:00 +02:00

24 lines
772 B
HTML

<!DOCTYPE html>
<script src="../include.js"></script>
<style id="test-style">
#target {
animation-name: "123fade";
animation-duration: 1s;
animation-fill-mode: both;
}
</style>
<div id="target">target</div>
<script>
asyncTest(async done => {
const target = document.getElementById("target");
const styleSheet = document.getElementById("test-style").sheet;
println(`opacity before keyframes: ${getComputedStyle(target).opacity}`);
styleSheet.insertRule('@keyframes "123fade" { from { opacity: 0.25; } to { opacity: 0.25; } }', styleSheet.cssRules.length);
await animationFrame();
println(`opacity after keyframes: ${getComputedStyle(target).opacity}`);
done();
});
</script>