blob: a52de393b6cb2db744240467fcac7d0b1d4a7e24 [file] [log] [blame]
<!DOCTYPE html>
| Test case which ensures that when a pseudo-element whose parent element has
| its display set to none, all running transitions on the pseudo-element are
| immediately ended.
| While the specification doesn't seem to say anything about this, it is
| how Chrome and Firefox both work, and it is also intuitively in line with
| the following behavior specified for CSS Animations:
| From,
| "Setting the display property to ‘none’ will terminate any running animation
| applied to the element and its descendants. If an element has a display of
| ‘none’, updating display to a value other than ‘none’ will start all
| animations applied to the element by the ‘animation-name’ property, as well
| as all animations applied to descendants with display other than ‘none’."
#block {
width: 100px;
height: 100px;
background-color: yellow;
font-size: 30px;
#block::after {
content: "";
transform: translateX(100px);
width: 100px;
height: 100px;
background-color: #0f0;
transition: background-color 1s linear;
<div id="block"></div>
if (window.testRunner) {
var blockDiv = document.getElementById('block');
window.addEventListener('load', function() {
if (window.testRunner) {
// Do a layout upon the load event so that we setup our source styles
// that we will be transitioning from.
// Modify the rule that targets the pseudo-element, to trigger the
// transition.
var sheet = document.styleSheets[0];
var rules = sheet.cssRules;
rules[1].style.backgroundColor = '#00f';
if (window.testRunner) {
// Do a layout to start the transition.
} = "none";
if (window.testRunner) {
} = "block";
if (window.testRunner) {
// Measure that the transition should now appear to be fully completed.