chromium/third_party/blink/web_tests/transitions/transition-end-event-nested.html

<html>
<head>
  <style>
    .box {
      position: relative;
      left: 0;
      height: 100px;
      width: 100px;
      margin: 10px;
      background-color: blue;
      transition-property: width, left, background-color, height, top;
      transition-duration: 0.06s;
    }
    
    .box1 {
      left: 50px;
    }
    
    .box2 {
      background-color: red;
    }
    
    .box3 {
      width: 150px;
      transition-duration: 0.1s;
    }
    
  </style>
  <script src="transition-end-event-helpers.js"></script>
  <script type="text/javascript">
    
    var expectedEndEvents = [
      // [property-name, element-id, elapsed-time, listen]
      ["background-color", "box2", 0.06, false],
      ["left", "box1", 0.06, false],
      ["width", "box3", 0.1, false],
    ];
    
    function handleEndEvent3(event)
    {
      recordTransitionEndEvent(event);
    }

    function handleEndEvent2(event)
    {
      recordTransitionEndEvent(event);

      var box = document.getElementById("box3");
      box.addEventListener("transitionend", handleEndEvent3, false);
      box.className = "box box3";
    }

    function handleEndEvent1(event)
    {
      recordTransitionEndEvent(event);
      
      var box = document.getElementById("box2");
      box.addEventListener("transitionend", handleEndEvent2, false);
      box.className = "box box2";
    }

    function setupTest()
    {
      var box = document.getElementById("box1");
      box.addEventListener("transitionend", handleEndEvent1, false);
      box.className = "box box1";
    }
    
    runTransitionTest(expectedEndEvents, setupTest);
  </script>
</head>
<body>

<p>Initiating transitions on various properties of all boxes.</p>

<div id="container">
  <div id="box1" class="box"></div>
  <div id="box2" class="box"></div>
  <div id="box3" class="box"></div>
</div>

<div id="result"></div>

</body>
</html>