PDA

View Full Version : [4.0.2a] DomHelper.insertIntoTable



westy
21 Jun 2011, 6:44 AM
In a similar manner to this bug (http://www.sencha.com/forum/showthread.php?137685-4.0.2a-Bug-in-Element.slideIn), it seems I'm getting a parentNide being null again in IE9.

In DomHelper:


function insertIntoTable(tag, where, el, html) {
var node,
before;

tempTableEl = tempTableEl || document.createElement('div');

if(tag == 'td' && (where == afterbegin || where == beforeend) ||
!tableElRe.test(tag) && (where == beforebegin || where == afterend)) {
return null;
}
before = where == beforebegin ? el :
where == afterend ? el.nextSibling :
where == afterbegin ? el.firstChild : null;

if (where == beforebegin || where == afterend) {
el = el.parentNode;
}

if (tag == 'td' || (tag == 'tr' && (where == beforeend || where == afterbegin))) {
node = ieTable(4, trs, html, tre);
} else if ((tag == 'tbody' && (where == beforeend || where == afterbegin)) ||
(tag == 'tr' && (where == beforebegin || where == afterend))) {
node = ieTable(3, tbs, html, tbe);
} else {
node = ieTable(2, ts, html, te);
}
el.insertBefore(node, before);
return node;
}


Where it's overwriting el with el.parentNode.

Difficult to override this, but I see from the call stack that it's called from insertSibling in code I changed in the referenced bug.
I'll put an additional guard in there.

Regards,
Westy