http://codereview.appspot.com/135054/diff/1/3
File src/com/google/caja/cajita.js (right):
http://codereview.appspot.com/135054/diff/1/3#newcode1598
Line 1598: var args = [self].concat(Array.slice(opt_args, 0));
that doesn't work, because opt_args might be an arguments object,
so we have to call Array.slice anyway.
Really? I thought apply could take an array like object, like
arguments, and so calling push indirectly would push the arguments onto
the end of the single element array.
$ var arr = [1,2,3]
$ arr.push.apply(arr, [4, 5, 6])
6
$ arr
1,2,3,4,5,6
$ (function () { arr.push.apply(arr, arguments); })(7, 8, 9)
arr
$ 1,2,3,4,5,6,7,8,9
In section 15.3.4.3 Function.prototype.apply (thisArg, argArray), there
is the following language in a number of places:
Otherwise, if argArray is neither an array nor an
arguments object (see 10.1.8), a TypeError exception
is thrown. If argArray is either an array or an
arguments object,
http://codereview.appspot.com/135054