Created
October 28, 2014 15:49
-
-
Save mnmly/1c01bc2242d7f371dc13 to your computer and use it in GitHub Desktop.
dumb 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 p = document.createElement('p'); | |
var prefixes = ['webkit','Moz','ms','O']; | |
var len = prefixes.length; | |
var style = p.style; | |
p = null; | |
module.exports = prefix; | |
function prefix(prop) { | |
for (i = 0; i < len; i++) { | |
name = prefixes[i] + prop; | |
if (style[name] !== undefined) { | |
return '-' + prefixes[i].toLowerCase() + '-' + prop; | |
} | |
} | |
return prop; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment