tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

display-none-prevents-starting-in-subtree.html (1253B)


      1 <!DOCTYPE html>
      2 <link rel=author href="mailto:graouts@webkit.org">
      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>