Skip to content

Commit 4587eeb

Browse files
authored
1 parent 295b981 commit 4587eeb

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<!DOCTYPE html>
2+
<link rel=author href="mailto:[email protected]">
3+
<link rel=help href="https://drafts.csswg.org/css-animations/#animations">
4+
<script src="/resources/testharness.js"></script>
5+
<script src="/resources/testharnessreport.js"></script>
6+
<script src="/css/css-animations/support/testcommon.js"></script>
7+
<style>
8+
@keyframes margin {
9+
100% { margin-left: 200px }
10+
}
11+
12+
#child {
13+
animation: margin 1s forwards;
14+
}
15+
</style>
16+
<div id="container">
17+
<div>
18+
<div id="child"></div>
19+
</div>
20+
</div>
21+
<script>
22+
test(() => {
23+
const container = document.getElementById("container");
24+
const animationCount = () => container.getAnimations({ subtree: true }).length;
25+
26+
assert_equals(animationCount(), 1, `An animation is running on the child initially with "display: block" on the container.`);
27+
28+
container.style.display = "none";
29+
assert_equals(animationCount(), 0, `Setting "display: none" on the container canceled the animation.`);
30+
31+
container.style.marginLeft = "50px";
32+
container.firstElementChild.style.marginLeft = "100px";
33+
assert_equals(animationCount(), 0, `Manipulating styles on the container and a child element does not restart the animation.`);
34+
}, 'Elements in a "display: none" tree cannot start CSS Animations.');
35+
</script>

0 commit comments

Comments
 (0)