2

I've created a Javacript Library called Tocl. I've tested it in Chrome and Safari and everythigs work properly. But when I test it on Mozilla browser (Firefox, Aurora) nothing happen here. I don't know whats going on here. The console says 'Tocl is undefined' and 'ToclObject' is not constructor. But on Chrome and Safari everythings is ok. Can you help find out whats wrong in my code?

This is my repository:

https://github.com/mahdaen/tocl

https://github.com/mahdaen/tocl/tree/master/sample

Thanks.

4

1 回答 1

1

我设法隔离了问题:

window.ToclObject = { bug : 'bug fixed'};
Object.defineProperty(window, 'ToclObject', {});

console.log(window.ToclObject.bug); // error

我还添加了一个修复:

window.ToclObject = { bug : 'bug fixed'};
Object.defineProperty(window, 'ToclObject', { value : window.ToclObject });
console.log(window.ToclObject.bug); // bug fixed

问题在这里找到:tocl.base.js:1260

PS:如果您对我如何隔离它感兴趣:

我将您的代码复制到显示问题的文件中并删除(删除)代码,直到错误不再显示。然后我回溯,看看我在错误显示和不显示和tada之间删除了什么......这就是问题所在。

于 2013-11-12T09:53:33.177 回答