Hammer.js: Uncaught TypeError: Cannot use 'in' operator to search for 'userSelect' in undefined in line (300)

Hammer.js: Uncaught TypeError: Cannot use 'in' operator to search for 'userSelect' in undefined in line (300)

导入 hammer.js 脚本后出现此错误,我该怎么办?

你能做什么,修复代码。

在第 2385 行附近:

function toggleCssProps(manager, add) {
    var element = manager.element;
    each(manager.options.cssProps, function(value, name) {
        if(prefixed(element.style, name) !== undefined) { //added line
            element.style[prefixed(element.style, name)] = add ? value : '';
        }
    });
}

第 300 行:

function prefixed(obj, property) {
    var prefix, prop;
    var camelProp = property[0].toUpperCase() + property.slice(1);

    var i = 0;
    while (i < VENDOR_PREFIXES.length) {
        prefix = VENDOR_PREFIXES[i];
        prop = (prefix) ? prefix + camelProp : property;

        if(obj === undefined) { //added line
            return undefined;
        }
        if (prop in obj) {
            return prop;
        }
        i++;
    }
    return undefined;
}