From 870ba16684b6eab5b8b14a3523e8b6f2e075c675 Mon Sep 17 00:00:00 2001 From: Joe Wreschnig Date: Tue, 23 Sep 2014 14:15:03 +0200 Subject: [PATCH] Work around a Safari JIT bug. --- src/yuu/yf.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/yuu/yf.js b/src/yuu/yf.js index 5df966d..3ea8b20 100644 --- a/src/yuu/yf.js +++ b/src/yuu/yf.js @@ -197,8 +197,17 @@ case 1: return function () { return f.call(this, arguments); }; default: return function () { - arguments[length - 1] = slice(arguments, length - 1); - return f.apply(this, arguments); + /* The following code can do this without creating a + new array, but it causes function calls to randomly + not happen in Safari (Mobile and OS X) - presumably + due to some JIT bug, because surrounding it in + an empty try/catch block also makes it work. + + arguments[length - 1] = slice(arguments, length - 1); + */ + var args = slice(arguments, 0, length - 1); + args.push(slice(arguments, length - 1)); + return f.apply(this, args); }; } } -- 2.30.2