Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix(events): fixing IE specific issues
Browse files Browse the repository at this point in the history
IE doesn't have Array#indexOf and [].splice.call doesn't work there
either.
  • Loading branch information
IgorMinar committed Aug 25, 2011
1 parent 1940128 commit 452607f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/Scope.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,10 +569,11 @@ Scope.prototype = {
* @param {function} listener Function to remove.
*/
$removeListener: function(name, listener) {
var namedListeners = this.$$listeners[name];
var i;
var namedListeners = this.$$listeners[name],
i;

if (namedListeners) {
i = namedListeners.indexOf(listener);
i = indexOf(namedListeners, listener);
namedListeners.splice(i, 1);
}
},
Expand Down
2 changes: 1 addition & 1 deletion test/ScopeSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ describe('Scope', function() {
scope.$broadcast('fooEvent', 'do', 're', 'me', 'fa');

expect(args.length).toBe(5);
expect([].splice.call(args, 1)).toEqual(['do', 're', 'me', 'fa']);
expect(sliceArgs(args, 1)).toEqual(['do', 're', 'me', 'fa']);
});
});
});
Expand Down

0 comments on commit 452607f

Please sign in to comment.