Question

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.

Was it helpful?

Solution

I managed to isolate the problem:

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

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

I also added a fix:

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

The problem is found here: tocl.base.js:1260

PS: If you're interested in how i isolated it:

I copied your code to a file that shows the problem and removed (deleted) code until the error wouldn't show. Then i backtracked to see what exactly i removed between the error showing and not showing and tada... that's where the problem was.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top