From c4b819e9b9792c8819ef60136aa4945884f4f84d Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Tue, 21 Apr 2009 05:04:49 -0400
Subject: [PATCH] - Speed up message list displaying on IE (initialize list in background) - use DOM methods instead of jQuery for messages list object

---
 program/js/list.js |   33 ++++++++++++++++++++++++---------
 1 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/program/js/list.js b/program/js/list.js
index dabcecb..5f017df 100644
--- a/program/js/list.js
+++ b/program/js/list.js
@@ -98,7 +98,7 @@
 
 
 /**
- *
+ * Init list row and set mouse events on it
  */
 init_row: function(row)
 {
@@ -123,7 +123,7 @@
 
 
 /**
- *
+ * Remove all list rows
  */
 clear: function(sel)
 {
@@ -154,20 +154,21 @@
 
 
 /**
- *
+ * Add row to the list and initialize it
  */
 insert_row: function(row, attop)
 {
-  var tbody = this.list.tBodies[0];
-  if (!row.jquery)
-    row = $(row);
+  if (this.background)
+    var tbody = this.background;
+  else
+    var tbody = this.list.tBodies[0];
 
   if (attop && tbody.rows.length)
-    row.prependTo(tbody)
+    tbody.insertBefore(row, tbody.firstChild);
   else
-    row.appendTo(tbody);
+    tbody.appendChild(row);
 
-  this.init_row(row[0]);
+  this.init_row(row);
   this.rowcount++;
 },
 
@@ -828,6 +829,20 @@
     }
 
   return rcube_event.cancel(e);
+},
+
+
+/**
+ * Creating the list in background
+ */
+set_background_mode: function(flag)
+{
+  if (flag) {
+    this.background = document.createElement('TBODY');
+  } else if (this.background) {
+    this.list.replaceChild(this.background, this.list.tBodies[0]);
+    this.background = null;
+  }
 }
 
 };

--
Gitblit v1.9.1