summaryrefslogtreecommitdiff
path: root/program/js/common.js
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-05-17 09:07:31 +0000
committeralecpl <alec@alec.pl>2010-05-17 09:07:31 +0000
commit27480b4a02c88009110b21b02fd5c8c5700e4697 (patch)
tree21b41ee68707e6cbf080ec9f31941e8d5f9b6221 /program/js/common.js
parent5d04a8592491da9782463a9f5b15ec926cceaff8 (diff)
- fix performance of getElementById wrapper for IE (don't look over all elements if initial getElementById returns no element
)
Diffstat (limited to 'program/js/common.js')
-rw-r--r--program/js/common.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/program/js/common.js b/program/js/common.js
index 69a2d579e..7ef183c93 100644
--- a/program/js/common.js
+++ b/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;
}
};