From ff1de7b1463060873dd1d03eb6e2ae8bdf60455f Mon Sep 17 00:00:00 2001 From: alec Date: Mon, 17 May 2010 09:07:31 +0000 Subject: - fix performance of getElementById wrapper for IE (don't look over all elements if initial getElementById returns no element ) git-svn-id: https://svn.roundcube.net/trunk@3623 208e9e7b-5314-0410-a742-e7e81cd9613c --- roundcubemail/program/js/common.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'roundcubemail/program') diff --git a/roundcubemail/program/js/common.js b/roundcubemail/program/js/common.js index 69a2d579e..7ef183c93 100644 --- a/roundcubemail/program/js/common.js +++ b/roundcubemail/program/js/common.js @@ -598,13 +598,14 @@ if (bw.ie) document._getElementById = document.getElementById; document.getElementById = function(id) { - var i = 0; - var o = document._getElementById(id); + var i = 0, obj = document._getElementById(id); - if (!o || o.id != id) - while ((o = document.all[i]) && o.id != id) - i++; + if (!obj || obj.id == id) + return obj; - return o; + while ((obj = document.all[i]) && obj.id != id) + i++; + + return obj; } }; -- cgit v1.2.3