javascript - 使用 Dojo 的 Firefox 中出现 NS_ERROR_UNEXPECTED 错误

标签 javascript firefox dojo xmlhttprequest

我在使用我的 Dojo (v.1.10.0) 应用程序时遇到了一个奇怪的问题,它在 Firefox 中被抛出。

这是我在 Firefox 中看到的以下错误:

Exception 
    { message: "",
      result: 2147549183, 
      name: "NS_ERROR_UNEXPECTED", 
      filename: "http://localhost:8888/dojo/on.js", 
      lineNumber: 354, 
      columnNumber: 0, 
      inner: null, 
      data: null 
    } 
  ""

不幸的是,我不确定在我的应用程序中该去哪里处理它。谁能指出我正确的方向?

在dojo/on的354行,是这样的:

 if(has("dom-addeventlistener")){
    // emitter that works with native event handling
    on.emit = function(target, type, event){
        if(target.dispatchEvent && document.createEvent){
            // use the native event emitting mechanism if it is available on the target object
            // create a generic event               
            // we could create branch into the different types of event constructors, but 
            // that would be a lot of extra code, with little benefit that I can see, seems 
            // best to use the generic constructor and copy properties over, making it 
            // easy to have events look like the ones created with specific initializers
            var ownerDocument = target.ownerDocument || document;
            var nativeEvent = ownerDocument.createEvent("HTMLEvents");
            nativeEvent.initEvent(type, !!event.bubbles, !!event.cancelable);
            // and copy all our properties over
            for(var i in event){
                if(!(i in nativeEvent)){
                    nativeEvent[i] = event[i];
                }
            }
            return target.dispatchEvent(nativeEvent) && nativeEvent; // Line 354
        }
        return syntheticDispatch.apply(on, arguments); // emit for a non-node
    };
}

最佳答案

这是一条普通的 FF 错误消息...它通常由计时或竞争条件触发,这可以解释为什么它会通过 dojo/on 出现。也许您尝试使用的目标或事件处理程序正在对已删除的内容执行操作,等等。如果不知道触发它的事件或没有看到您的完整代码示例,则不清楚。

例如,也许您正尝试在 DOM 可用之前添加事件监听器,但这只是一种猜测。或者可能目标节点不存在。

可以使用调试器查看事件参数的值,也可以查看你的各种事件注册机制等。

关于javascript - 使用 Dojo 的 Firefox 中出现 NS_ERROR_UNEXPECTED 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25630367/

相关文章:

javascript - dojo增强网格在特定单元格上动态设置可编辑错误不进行更改

javascript - Safari 中的 SVG 组元素不会触发 Wheel 事件

javascript - 更简单或更好的方法来检查 jqxgrid 是否没有要显示的数据(为空)?

javascript - 此功能在 Firefox 中不起作用

javascript - 在 Firefox 中定义自定义键

dojo - 使用 DOJO 对 JSON 进行排序并在树中显示

html - Dijit树,如何提高根下有500个子节点的大树的性能

javascript - Javascript 中的部分正则表达式匹配

javascript - html 对象在移动设备上不显示它应该显示的位置

firefox - Greasemonkey 脚本与 Firefox、Safari、Opera 和 chrome 的兼容性(onload 事件)