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 browserVersionOf(unprefixedName, parentObject) { | |
// parentObject is optional and usually omitted, set it to window if it's not specified. | |
parentObject = parentObject || window; | |
var baseName = unprefixedName.charAt(0).toUpperCase() + unprefixedName.substring(1); | |
var i = 0, variants = [unprefixedName, 'webkit', 'moz', 'ms', 'o']; | |
var fullName = variants[0]; | |
do { | |
if (typeof parentObject[fullName] == 'function') { | |
return parentObject[fullName]; | |
} |