Skip to content

Instantly share code, notes, and snippets.

@gregkepler
Created October 22, 2014 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregkepler/d26475d866ada549d569 to your computer and use it in GitHub Desktop.
Save gregkepler/d26475d866ada549d569 to your computer and use it in GitHub Desktop.
vendor prefix
// from http://davidwalsh.name/vendor-prefix
window.prefix = (function () {
var styles = window.getComputedStyle(document.documentElement, ''),
pre = (Array.prototype.slice
.call(styles)
.join('')
.match(/-(moz|webkit|ms)-/) || (styles.OLink === '' && ['', 'o'])
)[1],
dom = ('WebKit|Moz|MS|O').match(new RegExp('(' + pre + ')', 'i'))[1];
return {
dom: dom,
lowercase: pre,
css: '-' + pre + '-',
js: pre[0].toUpperCase() + pre.substr(1)
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment