Object.each, Object.keys... is not working properly, when I try to use an object that is a class attribute, check out this example :
var map = {a: 1, b: []};
var SomeClass = new Class({'map': map});
var sc = new SomeClass();
With a simple object everything works fine
console.log(map.hasOwnProperty('a'));
console.log(map.hasOwnProperty('b'));
console.log(Object.keys(map));
But with sc.map does not work with scalar values (int, boolean, string)
console.log(sc.map.hasOwnProperty('a'));
console.log(sc.map.hasOwnProperty('b'));
console.log(Object.keys(sc.map));
I understand that beacuse sc.map has a property __proto__
console.log(map.__proto__);
console.log(sc.map.__proto__);
I think this is a recent problem, because of this I have a huge pile of code, and some of them have stopped working. I do not want to change all my code to fix this problem, I assume that a patch is needed for mootools.
source
share