Fix problem with appendChild when appending a fragment (the fragment needs to be cleared)

This commit is contained in:
Davide P. Cervone 2012-01-17 11:21:58 -05:00
parent 31f654fd0b
commit 61abf6c9a6
2 changed files with 9 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@ -77,7 +77,8 @@
this.childNodes[i] = node; node.nextSibling = old.nextSibling;
old.nextSibling = old.parent = null;
return old;
}
},
toString: function () {return "{"+this.childNodes.join("")+"}"}
});
var INITASCIIMATH = function () {
@ -101,7 +102,12 @@
},
appendChild: function (node) {
if (node.parent) {node.parent.removeChild(node)}
var nodes = arguments; if (node.isa(DOCFRAG)) {nodes = node.childNodes}
var nodes = arguments;
if (node.isa(DOCFRAG)) {
nodes = node.childNodes;
node.data = node.childNodes = [];
node.firstChild = node.lastChild = null;
}
for (var i = 0, m = nodes.length; i < m; i++) {
node = nodes[i];
if (this.lastChild) {this.lastChild.nextSibling = node}