Skip to content

Instantly share code, notes, and snippets.

@unlight
Created December 10, 2011 09:29
Show Gist options
  • Select an option

  • Save unlight/1454874 to your computer and use it in GitHub Desktop.

Select an option

Save unlight/1454874 to your computer and use it in GitHub Desktop.
Check for css support
// Detect CSS3 Support
// http://net.tutsplus.com/tutorials/html-css-techniques/quick-tip-detect-css-support-in-browsers-with-javascript/
var IsSupportCssProperty = (function() {
var Dummy = document.createElement('dummy');
var Vendors = 'Khtml O Ms Webkit Moz '.split(' ');
var Length = Vendors.length;
var Px, CssProperty;
return function(PropertyName) {
for (var Index = Vendors.length - 1; Index >= 0; --Index) {
Px = Vendors[Index];
CssProperty = PropertyName;
if (Px.length > 0) CssProperty = Px + PropertyName.charAt(0).toUpperCase() + PropertyName.substr(1);
if (CssProperty in Dummy.style) return true;
}
return false;
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment