Created
February 7, 2015 06:20
-
-
Save ltchronus/0183a5d199e9444e6fd1 to your computer and use it in GitHub Desktop.
get browser's 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
function getVendorPrefix() { | |
// 使用body是为了避免在还需要传入元素 | |
var body = document.body || document.documentElement, | |
style = body.style, | |
vendor = ['webkit', 'khtml', 'moz', 'ms', 'o'], | |
i = 0; | |
while (i < vendor.length) { | |
// 此处进行判断是否有对应的内核前缀 | |
if (typeof style[vendor[i] + 'Transition'] === 'string') { | |
return vendor[i]; | |
} | |
i++; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment