-
-
Save jayeb/5078452 to your computer and use it in GitHub Desktop.
Code for testing css-transition support on pseudo-elements for Modernizr. Forked from diseltravis's Gist: https://gist.github.com/dieseltravis/3908275
With improvements borrowed from Ryan Seddon's JSFiddle: http://jsfiddle.net/ryanseddon/vLdUq/2/
This file contains 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
(function(Modernizr) { | |
var win = window, | |
transitionTo = "999px"; | |
function _finish(result) { | |
Modernizr.addTest("csstransitionspseudos", result); | |
} | |
if (Modernizr.csstransitions && win.getComputedStyle) { | |
Modernizr.testStyles( | |
"#modernizr:after{content:'';font-size:0;"+Modernizr._prefixes.join("transition:2s linear;")+"}"+ | |
"#modernizr.m:after{font-size:"+transitionTo+";}", | |
function(el) { | |
document.body.appendChild(el); | |
// Get the iniital computed style to force a browser style calc | |
win.getComputedStyle(el, ":after").fontSize; | |
el.className += "m"; | |
try { | |
_finish(win.getComputedStyle(el, ":after").fontSize !== transitionTo); | |
el.parentNode.removeChild(el); | |
} catch (e) {} | |
} | |
); | |
} else { | |
_finish(false); | |
} | |
})(Modernizr); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment