Ext.EventManager.removeFromSpecialCache() iterating past end of array error
Tested version: Ext JS 3.4.0, 3.4.1, 3.4.1.1 (Update May 2013)
Browsers: All
Code:
//Ext 3.4.1.1, ext-all-debug.js, line 5357
removeFromSpecialCache: function(o) {
var i = 0,
len = specialElCache.length;
for (; i < len; ++i) {
if (specialElCache[i].el == o) {
specialElCache.splice(i, 1);
}
}
},
When "specialElCache.splice(i, 1);" removes an item from the "specialElCache" array, array length is no longer "len" and causes "TypeError: specialElCache[i] is undefined" (Firefox) when iterating past the end of the array.
I am now using temporary fix:
Update May 2013: The previous fix solved the problem in IE9 (the only version of IE I've tested this time around) and caused another - some elements no longer get automatically destroyed and stayed visible. This is not a detailed problem description because I don't have the time to look into it. My solution is simply to bypass the function entirely if browser is IE. Works great so far. New fix is below:
Code:
removeFromSpecialCache: function(o) {
if(Ext.isIE){return}
var i = 0,
len = specialElCache.length;
for (; i < len; ++i) {
if (specialElCache[i].el == o) {
specialElCache.splice(i, 1);
len--;
}
}
},