Created
October 22, 2014 20:22
-
-
Save gregkepler/d26475d866ada549d569 to your computer and use it in GitHub Desktop.
vendor 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
// 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