Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// 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
return prop;
for (var len = prefixes.length; len--; ){
if ((prefixes[len] + upper) in
return (prefixes[len] + upper);
return false;
// btw this is available as Modernizr.prefixed(prop) now.
Copy link

paulirish commented Mar 29, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment