Created
February 3, 2014 18:22
-
-
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
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
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