-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WebKit export of https://bugs.webkit.org/show_bug.cgi?id=275739 (#47084)
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
css/css-animations/display-none-prevents-starting-in-subtree.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!DOCTYPE html> | ||
<link rel=author href="mailto:[email protected]"> | ||
<link rel=help href="https://drafts.csswg.org/css-animations/#animations"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/css/css-animations/support/testcommon.js"></script> | ||
<style> | ||
@keyframes margin { | ||
100% { margin-left: 200px } | ||
} | ||
|
||
#child { | ||
animation: margin 1s forwards; | ||
} | ||
</style> | ||
<div id="container"> | ||
<div> | ||
<div id="child"></div> | ||
</div> | ||
</div> | ||
<script> | ||
test(() => { | ||
const container = document.getElementById("container"); | ||
const animationCount = () => container.getAnimations({ subtree: true }).length; | ||
|
||
assert_equals(animationCount(), 1, `An animation is running on the child initially with "display: block" on the container.`); | ||
|
||
container.style.display = "none"; | ||
assert_equals(animationCount(), 0, `Setting "display: none" on the container canceled the animation.`); | ||
|
||
container.style.marginLeft = "50px"; | ||
container.firstElementChild.style.marginLeft = "100px"; | ||
assert_equals(animationCount(), 0, `Manipulating styles on the container and a child element does not restart the animation.`); | ||
}, 'Elements in a "display: none" tree cannot start CSS Animations.'); | ||
</script> |