Skip to content

Instantly share code, notes, and snippets.

@ceane
Created February 3, 2014 18:22
Show Gist options
  • Save ceane/8789365 to your computer and use it in GitHub Desktop.
Save ceane/8789365 to your computer and use it in GitHub Desktop.
Fastest way to get a browser prefix. http://jsperf.com/fastest-prefix-check/2
function testForComputedMatches() {
var prefixes = 'webkit moz ms o'.split(' '), lt = prefixes.length, prefix = '', computed;
while (lt--) {
computed = window.getComputedStyle && window.getComputedStyle(document.body).getPropertyValue("-"+prefixes[lt]+"-transform");
if (!!computed) {
prefix = prefixes[lt];
break;
}
}
return prefix;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment