summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2008-09-12 18:06:05 +0000
committeralecpl <alec@alec.pl>2008-09-12 18:06:05 +0000
commit6d89d65cd87e2bea02146a25265e017b7b85ef90 (patch)
tree8f1f33c785087a8caa227ae997a7a48f3642b023
parentbafadd89d7c39e3c2d61a51b59176bc10165e119 (diff)
-better getElementById wrapper for IE
-rw-r--r--program/js/common.js16
1 files changed, 4 insertions, 12 deletions
diff --git a/program/js/common.js b/program/js/common.js
index 649779746..1a5c0519c 100644
--- a/program/js/common.js
+++ b/program/js/common.js
@@ -639,21 +639,13 @@ if (bw.ie)
document._getElementById = document.getElementById;
document.getElementById = function(id)
{
- var a = [];
+ var i = 0;
var o = document._getElementById(id);
- while (o.id != id)
- {
- a.push({i:o.id,e:o});
- o.id = '';
- o = document._getElementById(id);
- if (!o) return o;
- }
-
- for (j=0,jj=a.length; j<jj; j++)
- a[j].e.id = a[j].i;
+ if (o.id != id)
+ while ((o = document.all[i]) && o.id != id)
+ i++;
- a = null;
return o;
}
}