aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/js/urweb.js
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-11-21 13:08:01 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-11-21 13:08:01 -0500
commit7a1666f77ee878a98f770b0d439ceb75f49ff1e2 (patch)
tree6f1fcd7f0d6a13e05384f850f5546a1f0ed02233 /lib/js/urweb.js
parent4bc02a044fde4fb5c6f347e942202307a2dbdaaa (diff)
Fix for lack of 'apply' method of IE6 native functions
Diffstat (limited to 'lib/js/urweb.js')
-rw-r--r--lib/js/urweb.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 62f94f52..ba1e9625 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -891,8 +891,27 @@ function exec1(env, stack, e) {
case "f":
fr.args[fr.pos++] = v;
if (fr.a == null) {
+ var res;
stack = stack.next;
- e = {c: "c", v: fr.f.apply(null, fr.args)};
+
+ if (fr.f.apply)
+ res = fr.f.apply(null, fr.args);
+ else if (fr.args.length == 0)
+ res = fr.f();
+ else if (fr.args.length == 1)
+ res = fr.f(fr.args[0]);
+ else if (fr.args.length == 2)
+ res = fr.f(fr.args[0], fr.args[1]);
+ else if (fr.args.length == 3)
+ res = fr.f(fr.args[0], fr.args[1], fr.args[2]);
+ else if (fr.args.length == 4)
+ res = fr.f(fr.args[0], fr.args[1], fr.args[2], fr.args[3]);
+ else if (fr.args.length == 5)
+ res = fr.f(fr.args[0], fr.args[1], fr.args[2], fr.args[3], fr.args[4]);
+ else
+ whine("Native function has " + fr.args.length + " args, but there is no special case for that count.");
+
+ e = {c: "c", v: res};
if (usedK) return null;
} else {
e = fr.a.data;