summaryrefslogtreecommitdiffstats
path: root/quicksearch.js
diff options
context:
space:
mode:
authorjustdave%syndicomm.com <>2001-07-20 17:25:30 +0200
committerjustdave%syndicomm.com <>2001-07-20 17:25:30 +0200
commit708fafdbfa042bea7e5bb006ca1bdcde69248431 (patch)
tree3bce7c23db0ad093451b97a87040a19951691735 /quicksearch.js
parentba1e58f58c3e679a69f23f525ab6c2df41403fb8 (diff)
downloadbugzilla-708fafdbfa042bea7e5bb006ca1bdcde69248431.tar.gz
bugzilla-708fafdbfa042bea7e5bb006ca1bdcde69248431.tar.xz
Re-fix for bug 77699: the undefined error affected other browsers than just IE5, so work around it for all browsers.
Patch by Stephen Lee <slee@uk.bnsmc.com> r= afranke@ags.uni-sb.de
Diffstat (limited to 'quicksearch.js')
-rw-r--r--quicksearch.js42
1 files changed, 17 insertions, 25 deletions
diff --git a/quicksearch.js b/quicksearch.js
index 7e4b85139..7778d3598 100644
--- a/quicksearch.js
+++ b/quicksearch.js
@@ -16,41 +16,33 @@
// Contributors:
// Stephen Lee <slee@uk.bnsmc.com>
-// variable below should be initialised according to whether
-// browser is IE 5.0 or earlier, but should be false for IE 5.5
-var is_IE5=(navigator.appVersion.search(/MSIE 5.0/g)>0);
+// Use no_result variable to avoid problems with "undefined" on some browsers
-// Bodge to get round IE5 not understanding "undefined", "shift" and "unshift"
+var no_result="---";
-var no_result=is_IE5?"---":undefined;
+// do_unshift(l, s) is equivalent to l.unshift(s), but some browsers do not
+// support the built-in function.
function do_unshift(l, s) {
- if(is_IE5) {
- l.length = l.length + 1;
- for (var i=l.length-1; i>0; i--) {
- l[i] = l[i-1];
- }
- l[0] = s;
- return l.length;
- }
- else {
- return l.unshift(s);
+ l.length = l.length + 1;
+ for (var i=l.length-1; i>0; i--) {
+ l[i] = l[i-1];
}
+ l[0] = s;
+ return l.length;
}
+// do_shift(l) is equivalent to l.shift(s), but some browsers do not
+// support the built-in function.
+
function do_shift(l) {
- if(is_IE5) {
- var l0=l[0];
- for (var i=0; i<l.length-1; i++) {
- l[i] = l[i+1];
- }
- l.length = l.length - 1;
- return l0;
- }
- else {
- return l.shift();
+ var l0=l[0];
+ for (var i=0; i<l.length-1; i++) {
+ l[i] = l[i+1];
}
+ l.length = l.length - 1;
+ return l0;
}
function go_to (url) {