adium 2751:70e57c04f788: Don't assume a single root node.

commits at adium.im commits at adium.im
Tue Oct 20 04:23:22 UTC 2009


details:	http://hg.adium.im/adium/rev/70e57c04f788
revision:	2751:70e57c04f788
author:		Stephen Holt <sholt at adium.im>
date:		Tue Oct 20 00:23:11 2009 -0400

Don't assume a single root node.

This should fix the odd (non-combined message) MUC behavior.

diffs (28 lines):

diff -r 5fd4260e1b0d -r 70e57c04f788 Plugins/WebKit Message View/Template.html
--- a/Plugins/WebKit Message View/Template.html	Mon Oct 19 19:26:30 2009 -0400
+++ b/Plugins/WebKit Message View/Template.html	Tue Oct 20 00:23:11 2009 -0400
@@ -48,8 +48,14 @@
 			
 			function createHTMLNode(html) {
 				var newMessage = document.createElement("div");
+				var documentFragment = document.createDocumentFragment();
 				newMessage.innerHTML = html;
-				return newMessage.firstChild;
+				
+				while(newMessage.hasChildNodes()) {
+					documentFragment.appendChild(newMessage.firstChild);
+				}
+				
+				return documentFragment;
 			}
 			
 			this.coalesce = function() {
@@ -86,7 +92,7 @@
 				var insert = self.fragment.querySelector("#insert");
 				if(insert) {
 					var node = createHTMLNode(html);
-					insert.insertBefore(node);
+					insert.parentNode.replaceChild(node, insert);
 				} else {
 					self.append(html, shouldScroll);
 				}




More information about the commits mailing list