ext6migrate: fix framework caching issue

in extjs 5/6 there is a caching issue, where they
save dom elements for reuse, but the garbage collector
can set them to null

when the framework now reuses the "cached" element it is null,
and any action on it produces an error, which breaks the site

for details see the forum link in the comment

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2016-03-14 13:41:23 +01:00 committed by Dietmar Maurer
parent f2a6ce6cf1
commit ee231e7918

View File

@ -112,6 +112,39 @@ Ext.override(Ext.form.field.ComboBox, {
}
});
// ExtJs 5-6 has an issue with caching
// see https://www.sencha.com/forum/showthread.php?308989
Ext.define('PVE.UnderlayPool', {
override: 'Ext.dom.UnderlayPool',
checkOut: function () {
var cache = this.cache,
len = cache.length,
el;
// do cleanup because some of the objects might have been destroyed
while (len--) {
if (cache[len].destroyed) {
cache.splice(len, 1);
}
}
// end do cleanup
el = cache.shift();
if (!el) {
el = Ext.Element.create(this.elementConfig);
el.setVisibilityMode(2);
//<debug>
// tell the spec runner to ignore this element when checking if the dom is clean
el.dom.setAttribute('data-sticky', true);
//</debug>
}
return el;
}
});
Ext.define('Ext.ux.IFrame', {
extend: 'Ext.Component',