JSFiddle - React, Tailwind, and code Playground

by gasp10

HTML

<div id="test" class="some-control">container text</div>

CSS

@keyframes nodeInserted {  
    from {  
        clip: rect(1px, auto, auto, auto);  
    }
    to {  
        clip: rect(0px, auto, auto, auto);
    }  
}

@-moz-keyframes nodeInserted {  
    from {  
        clip: rect(1px, auto, auto, auto);  
    }
    to {  
        clip: rect(0px, auto, auto, auto);
    }  
}

@-webkit-keyframes nodeInserted {  
    from {  
        clip: rect(1px, auto, auto, auto);  
    }
    to {  
        clip: rect(0px, auto, auto, auto);
    }  
}

@-ms-keyframes nodeInserted {  
    from {  
        clip: rect(1px, auto, auto, auto);  
    }
    to {  
        clip: rect(0px, auto, auto, auto);
    }  
}

@-o-keyframes nodeInserted {  
    from {  
        clip: rect(1px, auto, auto, auto);  
    }
    to {  
        clip: rect(0px, auto, auto, auto);
    }  
} 
body * {
    padding: 50px;
    background: #FF6A6A;
    animation-duration: 0.0001s;
    -o-animation-duration: 0.0001s;
    -ms-animation-duration: 0.0001s;
    -moz-animation-duration: 0.0001s;
    -webkit-animation-duration: 0.0001s;
    animation-name: nodeInserted;
    -o-animation-name: nodeInserted;
    -ms-animation-name: nodeInserted;        
    -moz-animation-name: nodeInserted;
    -webkit-animation-name: nodeInserted;
}

div.some-control div.some-control {
    background: #87CEFF;
}

JavaScript

(function(){

var count = 1,
    event = function(event){
        if (event.animationName == 'nodeInserted') {
        	event.target.textContent = 'Element ' + count++ + ' has been parsed!';
          console.log("animation test");
        }

    }
        
document.addEventListener('animationstart', event, false);
document.addEventListener('MSAnimationStart', event, false);
document.addEventListener('webkitAnimationStart', event, false);

setTimeout(function(){
    var div = document.createElement('div');
    div.addClass('some-control');
    document.getElementById('test').appendChild(div);
    setTimeout(function(){
   	  var div = document.createElement('div');
    	div.addClass('some-control');
    	document.getElementById('test').appendChild(div)
		}, 2000);
}, 2000);


})();