Skip to content

Instantly share code, notes, and snippets.

@mnmly
Created October 28, 2014 15:49
Show Gist options
  • Save mnmly/1c01bc2242d7f371dc13 to your computer and use it in GitHub Desktop.
Save mnmly/1c01bc2242d7f371dc13 to your computer and use it in GitHub Desktop.
dumb prefix
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