移动端FastClick和editor冲突问题。

    FastClick.prototype.needsClickForParent = function (target) {
        let parent = target.parentNode;
        if (parent == null) {
            return false;
        }
        let b = (/\bneedsclick\b/).test(parent.className)
        if (!b) {
            return this.needsClickForParent(parent);
        } else {
            return true;
        }
    }
 
    FastClick.prototype.needsClick = function (target) {
        if (this.needsClickForParent(target) === true) {
            return true;
        }
        switch (target.nodeName.toLowerCase()) {

            // Don't send a synthetic click to disabled inputs (issue #62)
            case 'button':
            case 'select':
            case 'textarea':
                if (target.disabled) {
                    return true;
                }

                break;
            case 'input':

                // File inputs need real clicks on iOS 6 due to a browser bug (issue #68)
                if ((deviceIsIOS && target.type === 'file') || target.disabled) {
                    return true;
                }

                break;
            case 'label':
            case 'iframe': // iOS8 homescreen apps can prevent events bubbling into frames
            case 'video':
                return true;
        }

        return (/\bneedsclick\b/).test(target.className);
    };
posted @ 2018-04-03 14:01  情三  阅读(503)  评论(0编辑  收藏  举报