Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE html>
<title>CSS Values and Units Test: sibling-index() changing transform during @keyframes animation</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
@keyframes --anim {
from {
transform: translateX(calc(10px * sibling-index()));
}
to {
transform: none;
}
}
#target {
animation: --anim 1000s step-end;
}
</style>
<div>
<div id="rm"></div>
<div></div>
<div id="target"></div>
</div>
<script>
test(() => {
assert_equals(getComputedStyle(target).transform, "matrix(1, 0, 0, 1, 30, 0)");
}, "Initially, the sibling-index() is 3 for #target");
test(() => {
rm.remove();
assert_equals(getComputedStyle(target).transform, "matrix(1, 0, 0, 1, 20, 0)");
}, "Removing a preceding sibling of #target reduces the sibling-index()");
</script>