Skip to content

Instantly share code, notes, and snippets.

@argyleink
Created April 22, 2013 21:35
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 argyleink/5438763 to your computer and use it in GitHub Desktop.
Save argyleink/5438763 to your computer and use it in GitHub Desktop.
Require.js ready vendor prefix extractor
vendor.prefix = (function () {
'use strict';
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