I have not standard problem with my service.
I'm using library Zepto in my SaaS script on client's sites. But 2 hours ago one of my clients wrote me, that my script is not working. I checked all code and found that: he using Prototype JavaScript framework, version 1.7
. And in this code I see:
var Enumerable = (function() {
...
function each(iterator, context) {...}
function all(iterator, context) {...}
...
}();
I mean, that all native array methods are overwrote. Zepto.js using this native methods:
each: function(callback){
emptyArray.every.call(this, function(el, idx){
return callback.call(el, idx, el) !== false
})
return this
},
where
emptyArray = [];
I think this version of prototype library has some bug because (from console:)
xxx:xxx Uncaught RangeError: Maximum call stack size exceeded
There are circle with Zepto's emtyArray.each and Enumerable.all functions.
My question is, how can I use method [].all
instead overwrited [].prototype.all
?
Update
var words = ['hello', 'world', '!'];
console.log('Before overwrite');
[].every.call(words, function(el, idx) {
console.log(el);
});
Array.prototype.every = function(iterator, context)
{
console.error('not works');
}
console.log('After overwrite');
[].every.call(words, function(el, idx) {
console.log(el);
});
How to use native .every again?