all files / popper/utils/ getSupportedPropertyName.js

87.5% Statements 7/8
50% Branches 2/4
100% Functions 1/1
87.5% Lines 7/8
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21                194× 194×   194× 194× 194× 194× 194×          
/**
 * Get the prefixed supported property name
 * @method
 * @memberof Popper.Utils
 * @argument {String} property (camelCase)
 * @returns {String} prefixed property (camelCase)
 */
export default function getSupportedPropertyName(property) {
    const prefixes = [false, 'ms', 'webkit', 'moz', 'o'];
    const upperProp = property.charAt(0).toUpperCase() + property.slice(1);
 
    for (let i = 0; i < prefixes.length -1; i++) {
        const prefix = prefixes[i];
        const toCheck = prefix ? `${prefix}${upperProp}` : property;
        Eif (typeof window.document.body.style[toCheck] !== 'undefined') {
            return toCheck;
        }
    }
    return null;
}