Skip to content

Instantly share code, notes, and snippets.

Embed
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 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.
@paulirish

This comment has been minimized.

Copy link
Owner Author

@paulirish paulirish commented Mar 29, 2012

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