When developping complex application, you will find yourself struggle with IE random error (sometime making application break).
I have identified some of the random bugs :
- animation sometime failed as the required element sometime is not available (The code base do not check if the element exists or not, see fxUnwrap)
- IE randomly hate syntax like this (found in ExtJS code base) :
var d = this.dom, type = typeof d[ns+':'+name];
So I've create an override that fix thoses things, hoping it will help you kick the IE in the asses :
PHP Code:
(function()
{
var flyEl = new Ext.Element.Flyweight();
var fly = function(dom)
{
flyEl.dom = dom;
flyEl.id = Ext.id(dom);
return flyEl;
};
Ext.Fx.fxUnwrap = function(wrap, pos, o)
{
var dom = this.dom;
fly(dom).clearPositioning();
fly(dom).setPositioning(pos);
if (!o.wrap) {
var pn = fly(wrap).dom.parentNode;
if (pn) { // should check if it's not null
pn.insertBefore(dom, wrap);
fly(wrap).remove();
}
}
};
Ext.Element.addMethods(Ext.Fx);
// I prefer doing like this because I'm using JSLint so the syntax like under is not really appreciated
// Obj.prototype.method = Ext.isIE ? function() { } .. : function() { }
if (Ext.isIE) {
Ext.Element.prototype.getAttribute = function(name, ns)
{
var d = this.dom, type = 'undefined';
try {
// IE sometime failed here, so try to catch the exception
type = typeof(d[ns + ":" + name]);
}
catch(e) {
type = 'undefined';
}
if (['undefined', 'unknown'].indexOf(type) == -1) {
return d[ns + ":" + name];
}
return d[name];
};
}
else {
Ext.Element.prototype.getAttribute = function(name, ns)
{
var d = this.dom;
return d.getAttributeNS(ns, name) || d.getAttribute(ns + ":" + name) || d.getAttribute(name) || d[name];
};
}
})();
As always, don't hesitate to give feedback and contribute this post, because I surely have not covered all possible IE annoyances.