Javascript错误未捕获异常

Ama*_*jee 7 javascript jquery ios

我正在使用一个名为的javascript文件 pull.js.它用于Ipad中的下拉刷新,但是,当我使用其他jquery和javascript停止工作?它给出了以下未捕获的异常错误:

"错误:未捕获的异常:

[异常... "没有足够的参数" nsresult: "0x80570001(NS_ERROR_XPC_NOT_ENOUGH_ARGS)" 位置: "JS帧:: pull.js ::匿名::线26" 的数据:无]"

我正在传递此js文件的内容:

var PULL = function() {
    var content,
        pullToRefresh,
        refreshing,
        contentStartY,
        success,
        start,
        cancel,
        startY,
        track = false,
        refresh = false;

    var removeTransition = function() {
        //content.style['-webkit-transition-duration'] = 0;
    };
    return {
        init: function(o) {
            content = document.getElementById('content');
            pullToRefresh = document.getElementById('pull_to_refresh');
            refreshing = document.getElementById('refreshing');
            success = o.success;
            start = o.start;
            cancel = o.cancel;

            document.body.addEventListener('touchstart', function(e) {
                e.preventDefault();
                contentStartY = parseInt(content.style.top);
                startY = e.touches[0].screenY;
            });

            document.body.addEventListener('touchend', function(e) {
                if(refresh) {
                    //content.style['-webkit-transition-duration'] = '.5s';
                    content.style.top = '50px';

                    pullToRefresh.style.display = 'none';
                    refreshing.style.display = '';

                    success(function() { // pass down done callback
                        pullToRefresh.style.display = '';
                        refreshing.style.display = 'none';
                        content.style.top = '0';
                        content.addEventListener('transitionEnd', removeTransition);
                    });

                    refresh = false;
                } else if(track) {
                    //content.style['-webkit-transition-duration'] = '.25s';
                    content.style.top = '0';
                    content.addEventListener('transitionEnd', removeTransition);

                    cancel();
                }
                track = false;
            });

            document.body.addEventListener('touchmove', function(e) {
                var move_to = contentStartY - (startY - e.changedTouches[0].screenY);
                if(move_to > 0) track = true; // start tracking if near the top
                content.style.top = move_to + 'px';

                if(move_to > 50) {
                    refresh = true;
                } else {
                    //content.style['-webkit-transition'] = '';
                    refresh = false;
                }
            });
        }
    };
}();
Run Code Online (Sandbox Code Playgroud)

谁能帮帮我吗.

Esa*_*ija 5

XPC错误不是来自调用纯Javascript方法parseInt(并且radix参数 在规范中可选的,因此所有这些注释在许多方面都是错误的).


错过了useCapture所有addEventListener通话的第三个参数:

这里:

document.body.addEventListener('touchstart', function(e) {
    ...
}, false);  //<-- add third argument
Run Code Online (Sandbox Code Playgroud)

这里:

content.addEventListener('transitionEnd', removeTransition, false);  //<-- add third argument
Run Code Online (Sandbox Code Playgroud)

这里:

document.body.addEventListener('touchend', function(e) {
    ...
}, false);  //<-- add third argument
Run Code Online (Sandbox Code Playgroud)

这里:

content.addEventListener('transitionEnd', removeTransition, false);  //<-- add third argument
Run Code Online (Sandbox Code Playgroud)

和这里:

document.body.addEventListener('touchmove', function(e) {
    ...
}, false); //<-- add third argument
Run Code Online (Sandbox Code Playgroud)

请注意,在较新的规范中,参数已成为可选参数.但这并不重要.