Closed GoogleCodeExporter closed 9 years ago
I forgot that "content" could have more than a single child, so it will be
necessary
to iterate over the "tmpElem" children (with nodeType ELEMENT_NODE)
Original comment by riqu...@gmail.com
on 27 Jan 2009 at 12:33
I wrote a possible function that handle multiple first level children in the
string(
it doesn't attach the element to the body anymore because it seems to work
anyway).
Tested on firefox 3.0.5 (linux) and safari 3.2.1 (linux via wine)
// to test it, replace the current addContent function with the following code
addContent : function (content) {
var type = typeof content;
if (type === "string" || type === "number") {
var tmpElem=document.createElement("div");
tmpElem.innerHTML=content; // let the browser parse content for us
var children=tmpElem.childNodes,child=null,last=null;
for (var i=children.length-1;i>=0;i--){
child=children[i];
if (child.nodeType===child.ELEMENT_NODE) {
last=this.insertBefore(child,last);
}
}
}
else if (type === "object" || (type === "function" && !!content.nodeName)) {
this.appendChild(content);
}
return this;
}
Original comment by riqu...@gmail.com
on 28 Jan 2009 at 1:12
Thanks for the comprehensive bug report Riccardo! I'll look into this.
Original comment by chengh...@gmail.com
on 28 Jan 2009 at 8:15
Check SVN for fixed version.
Original comment by chengh...@gmail.com
on 19 Apr 2009 at 4:03
Original issue reported on code.google.com by
riqu...@gmail.com
on 26 Jan 2009 at 11:25