Skip to content

Instantly share code, notes, and snippets.

@qmmr
Created December 13, 2012 14:14
Show Gist options
  • Save qmmr/4276623 to your computer and use it in GitHub Desktop.
Save qmmr/4276623 to your computer and use it in GitHub Desktop.
Test for CSS3 support in browser.
var supports = (function(prop) {
var
div = doc.createElement('div')
, vendors = 'Khtml Ms O Moz Webkit'.split(' ')
;
return function (prop) {
var len = vendors.length;
if (prop in div.style) return true;
prop = prop.replace(/^[a-z]/, function(val) {
return val.toUpperCase();
});
while (len--) {
if (vendors[len] + prop in div.style) {
return true;
}
}
return false;
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment