Created
August 9, 2013 10:44
-
-
Save lylijincheng/6192732 to your computer and use it in GitHub Desktop.
CSS style prefix.
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
var prefixStyle = function(style) { | |
var i, len, vendor, vendors, blank, camel; | |
vendors = ['', 'webkit', 'ms', 'Moz', 'O']; | |
blank = document.createElement('div').style; | |
camel = style.charAt(0).toUpperCase() + style.slice(1); | |
for (i = 0, len = vendors.length; i < len; i += 1) { | |
vendor = vendors[i] + camel; | |
if (vendor in blank) { | |
return vendor; | |
} | |
} | |
return style; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment