From 3d5719cd44868f89352ebbedd0e1b1f2575520cb Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Wed, 11 Aug 2010 11:44:12 -0700 Subject: removed undocumented/unneeded methods from Array API --- src/Angular.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'src/Angular.js') diff --git a/src/Angular.js b/src/Angular.js index 902ae013..3970f762 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -291,19 +291,17 @@ function escapeAttr(html) { '"'); } -function bind(_this, _function) { - var curryArgs = slice.call(arguments, 2, arguments.length); - if (typeof _function == 'function') { - return curryArgs.length == 0 ? - function() { - return _function.apply(_this, arguments); - } : - function() { - return _function.apply(_this, curryArgs.concat(slice.call(arguments, 0, arguments.length))); - }; +function bind(self, fn) { + var curryArgs = arguments.length > 2 ? slice.call(arguments, 2, arguments.length) : []; + if (typeof fn == 'function') { + return curryArgs.length ? function() { + return arguments.length ? fn.apply(self, curryArgs.concat(slice.call(arguments, 0, arguments.length))) : fn.apply(self, curryArgs); + }: function() { + return arguments.length ? fn.apply(self, arguments) : fn.call(self); + }; } else { // in IE, native methods ore not functions and so they can not be bound (but they don't need to be) - return _function; + return fn; } } -- cgit v1.2.3