From: vyshane Date: Fri, 1 Dec 2006 02:40:47 +0000 (+0000) Subject: Merged from 1.7. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=da28afbb3b50bf03049b63d003140a59f616f3f0;p=moodle.git Merged from 1.7. --- diff --git a/lib/ajax/section_classes.js b/lib/ajax/section_classes.js index 10aa4bb6b0..c475e2e2f3 100755 --- a/lib/ajax/section_classes.js +++ b/lib/ajax/section_classes.js @@ -367,17 +367,15 @@ section_class.prototype.remove_resource = function(el) { } } } - //remove "text" nodes to keep DOM clean - var childIndex = null; - var childrenCount = this.resources_ul.childNodes.length; - for (var i=0; i 0 && childIndex < this.resources_ul.childNodes.length) { - this.resources_ul.removeChild(this.resources_ul.childNodes[childIndex - 1]); + // Remove any extra text nodes to keep DOM clean. + var kids = el.getEl().parentNode.childNodes; + var i = kids.length; + while (i--) { + if (kids[i].nodeType == 3) { + kids[i].parentNode.removeChild(kids[i]); + } } + YAHOO.log("Removing "+el.getEl().id); if (el.getEl().parentNode != null) { el.getEl().parentNode.removeChild(el.getEl());