Created
June 18, 2014 16:41
-
-
Save DomenicoColandrea86/bb06fe782346df5c4758 to your computer and use it in GitHub Desktop.
Modernizr feature-detect for css transitions on pseudos elements
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
| // transitions pseudos test. | |
| // check if CSS3 transitions take effect on pseudo elements. | |
| // https://github.com/Modernizr/Modernizr/issues/295 | |
| // This test is asynchronous. Watch out. | |
| // without csstransitions this check makes no sense and | |
| // without getComputedStyle we wont be able to get the style from a pseudo element | |
| if (Modernizr.csstransitions && window.getComputedStyle) { | |
| Modernizr.testStyles( | |
| '#modernizr:after{content:"";font-size:0;'+ Modernizr._prefixes.join('transition:2s;') +'}' + | |
| '#modernizr._m:after{font-size:999px;}', | |
| function(elem) { | |
| elem.className = '_m'; | |
| setTimeout(function() { | |
| Modernizr.addTest( | |
| 'csstransitionspseudos', | |
| window.getComputedStyle(elem, ':after').fontSize !== '999px' | |
| ); | |
| }, 50); | |
| } | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment