一个非常小众的问题:
我有时(30% 的时间)在 prototype.js 库(来自 google 的版本 1.6.0.2:http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.2/prototype.js)的第 3877 行收到“未定义的处理程序”javascript 错误。
现在在这个页面上我有一个谷歌地图,我使用原型(prototype)窗口库。
问题出现在IE7和FF3中。
这是 FireBug 提供的信息:
handler is undefined
? in prototype.js@3871()prototype.js (line 3877)
handler.call(element, event);
我切换到本地版本的 prototypejs 并在有问题的方法 (createWraper) 中添加了一些调试,但调试从未出现在错误之前...
我四处搜索,在同一行中发现了另外 1 个提到的错误,但没有答案,所以我将其张贴在这里,也许有一天会有人得到答案:)。
最佳答案
我刚刚发现如果您在观察者调用中不小心留在括号中,也会发生此错误:
Event.observe(document, 'myapp:application_ready', myapp.MyClass.initApp());
代替
Event.observe(document, 'myapp:application_ready', myapp.MyClass.initApp);
关于javascript - 来自 prototype.js 第 3877 行的 "undefined handler",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43584/