Created
August 13, 2010 23:13
-
-
Save paulirish/523692 to your computer and use it in GitHub Desktop.
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
// find out what prefix this browser supports. | |
// usage: gimmePrefix('transform') // 'WebkitTransform' | |
// returns false if unsupported. | |
function gimmePrefix(prop){ | |
var prefixes = ['Moz','Khtml','Webkit','O','ms'], | |
elem = document.createElement('div'), | |
upper = prop.charAt(0).toUpperCase() + prop.slice(1); | |
if (prop in elem.style) | |
return prop; | |
for (var len = prefixes.length; len--; ){ | |
if ((prefixes[len] + upper) in elem.style) | |
return (prefixes[len] + upper); | |
} | |
return false; | |
} | |
// btw this is available as Modernizr.prefixed(prop) now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
see paulirish/lazyweb-requests#45