<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAnimationsCSSIntegrationEnabled=false ] -->
<style>
.target {
  -webkit-perspective: 20px;
  perspective: 20px;
}
</style>
<div class="target">all 10ms</div><br>
<div class="target">perspective 10ms</div><br>
<div class="target">-webkit-perspective 10ms</div><br>
<script>
if (window.testRunner) {
  testRunner.dumpAsText();
  testRunner.waitUntilDone();
}

document.addEventListener('transitionend', function(e) {
  var result = document.createElement('div');
  result.textContent = 'fired transitionend with propertyName: ' + e.propertyName;
  e.target.appendChild(result);
  if (window.testRunner) {
    // All events should be fired by next frame.
    requestAnimationFrame(function() {
      testRunner.notifyDone();
    });
  }
});

onload = function() {
  var targets = document.querySelectorAll('.target');
  for (var i = 0; i < targets.length; i++) {
    targets[i].offsetTop;
    targets[i].style.transition = targets[i].textContent;
    targets[i].style.webkitPerspective = '10px';
    targets[i].style.perspective = '10px';
  }
};
</script>
