Javascript错误未捕获异常

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


Error: uncaught exception:

[Exception… “Not enough arguments” nsresult: “0x80570001
(NS_ERROR_xpc_NOT_ENOUGH_ARGS)” location: “JS frame :: pull.js ::
anonymous :: line 26” data: no]

我正在传递此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;
                }
            });
        }
    };
}();

谁能帮帮我吗.

解决方法

xpc错误不是来自调用像parseInt这样的纯Javascript方法(和radix参数)
是规范可选的,因此所有这些评论在很多方面都是错误的).

您在所有addEventListener调用上都是missing the third useCapture argument

这里:

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

这里:

content.addEventListener('transitionend',removeTransition,false);  //<-- add third argument

这里:

document.body.addEventListener('touchend',false);  //<-- add third argument

和这里:

document.body.addEventListener('touchmove',false); //<-- add third argument

请注意,在newer specification,the argument has been made optional.但这并不重要.

相关文章

前言 做过web项目开发的人对layer弹层组件肯定不陌生,作为l...
前言 前端表单校验是过滤无效数据、假数据、有毒数据的第一步...
前言 图片上传是web项目常见的需求,我基于之前的博客的代码...
前言 导出Excel文件这个功能,通常都是在后端实现返回前端一...
前言 众所周知,js是单线程的,从上往下,从左往右依次执行,...
前言 项目开发中,我们可能会碰到这样的需求:select标签,禁...