documentcloud/backbone — pull request #1282 by lifesinger (2012-05-04 15:28:53+00:00)
Title: Refactor Backbone.Events and fix an altering bug.

Using linked-list to implement Events is very cool, but it is not easy to freezing all the callback lists when triggering. An altering bug still exists in Backbone v0.9.2:

```js
var counter = 0, obj = _.extend({}, Backbone.Events);
var incr = function(){ counter++; };

obj.on('x', function() { obj.on('y', incr).on('all', incr); })
.trigger('x y');
equal(counter, 0, 'should not alter other event callback list');
obj.trigger('y');
equal(counter, 2, 'ok now');
```

When `trigger("x y")`, the callback of x should not affect the callback list of y, same as to 'all'.

And the performance seems to be better: http://jsperf.com/backbone-events-linked-list/6