Created
May 15, 2013 03:02
-
-
Save zmmbreeze/5581376 to your computer and use it in GitHub Desktop.
Mutation event fall back
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* set up the keyframes */ | |
| @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); } | |
| } | |
| #parentElement > li { | |
| animation-duration: 0.001s; | |
| -o-animation-duration: 0.001s; | |
| -ms-animation-duration: 0.001s; | |
| -moz-animation-duration: 0.001s; | |
| -webkit-animation-duration: 0.001s; | |
| animation-name: nodeInserted; | |
| -o-animation-name: nodeInserted; | |
| -ms-animation-name: nodeInserted; | |
| -moz-animation-name: nodeInserted; | |
| -webkit-animation-name: nodeInserted; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var insertListener = function(event){ | |
| if (event.animationName == "nodeInserted") { | |
| // This is the debug for knowing our listener worked! | |
| // event.target is the new node! | |
| console.warn("Another node has been inserted! ", event, event.target); | |
| } | |
| } | |
| document.addEventListener("animationstart", insertListener, false); // standard + firefox | |
| document.addEventListener("MSAnimationStart", insertListener, false); // IE | |
| document.addEventListener("webkitAnimationStart", insertListener, false); // Chrome + Safari |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment