ladybird/Tests/LibWeb/Text/input/WebAnimations/misc/get-animations-should-make-sure-style-is-updated.html
Aliaksandr Kalenik 94b3b84dd8 LibWeb: Make sure style is up-to-date in getAnimations()
StyleComputer is responsible for assigning animation targets, so we
have to make sure there are no pending style updates before querying
animations of an element.

This change also introduces a version of getAnimations() that does not
check style updates and used by StyleComputer to avoid mutual recursion.
2024-10-02 16:28:37 +01:00

26 lines
597 B
HTML

<!DOCTYPE html>
<script src="../../include.js"></script>
<style>
@keyframes test {
from {
background-color: green;
}
to {
background-color: yellow;
}
}
#animated {
width: 100px;
height: 100px;
background-color: green;
animation: test 2s infinite;
}
</style>
<div id="animated">This is a animated div</div>
<script>
const animationCount = document.getElementById("animated").getAnimations().length;
test(() => {
println(`animation count: ${animationCount}`);
});
</script>