-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not alter the "on" events array #3463
Conversation
What does this give us? |
The test was a false positive. "bind does not alter callback list" and "unbind does not alter callback list". |
Couldn't we also |
Yup. I think the real point of these tests was to make sure |
Totally, and agreed. Can we just add the tests without making changes at the moment, or are you saying the tests would be broken too? If that's the case my personal preference would be to slice over the array in trigger, rather than in on, since it just feels more correct. |
Close, but not quite. The point of the test is to make sure
I'd prefer this approach if it's an issue. It was once done this way and I don't remember why it changed. 😕 |
The tests would be broken if this were merged without the |
That would make sense too 😄. Let me look into this again. |
Coolio. Thanks @jridgewell! 😃 |
a61ddb4
to
5e38324
Compare
Ping. Let me know how you feel about it now. It's just a cleanup of the test. My If it is, we would just have to |
5e38324
to
3d3f0a0
Compare
[js perf](http://jsperf.com/backbone-events-linked-list/18) Roughly equivalent performance. Using a linked list allows the events to be mutated by trigger, without skipping an event. This is a **breaking change**. Events used to use a linked list (and switched to an array in jashkenas#1284). But, it performed [very badly](http://jsperf.com/backbone-events-linked-list/8). I'm fairly certain that was due to [L106](https://github.com/jashkenas/backbone/blob/6c3d3838e10d5a070f0d1f604fb5c99ed34c8c93/backbone.js#L106) recreating the linked list's object every `#on`, and [L138](https://github.com/jashkenas/backbone/blob/6c3d3838e10d5a070f0d1f604fb5c99ed34c8c93/backbone.js#L138) calling `#on` to re-bind callbacks. This fixes jashkenas#3466 and closes jashkenas#3463.
[js perf](http://jsperf.com/backbone-events-linked-list/18) Roughly equivalent performance. Using a linked list allows the events to be mutated by trigger, without skipping an event. This is a **breaking change**. Events used to use a linked list (and switched to an array in jashkenas#1284). But, it performed [very badly](http://jsperf.com/backbone-events-linked-list/8). I'm fairly certain that was due to [L106](https://github.com/jashkenas/backbone/blob/6c3d3838e10d5a070f0d1f604fb5c99ed34c8c93/backbone.js#L106) recreating the linked list's object every `#on`, and [L138](https://github.com/jashkenas/backbone/blob/6c3d3838e10d5a070f0d1f604fb5c99ed34c8c93/backbone.js#L138) calling `#on` to re-bind callbacks inside `#off`. This fixes jashkenas#3466 and closes jashkenas#3463.
[js perf](http://jsperf.com/backbone-events-linked-list/18) Roughly equivalent performance. Using a linked list allows the events to be mutated by trigger, without skipping an event. This is a **breaking change**. Events used to use a linked list (and switched to an array in jashkenas#1284). But, it performed [very badly](http://jsperf.com/backbone-events-linked-list/8). I'm fairly certain that was due to [L106](https://github.com/jashkenas/backbone/blob/6c3d3838e10d5a070f0d1f604fb5c99ed34c8c93/backbone.js#L106) recreating the linked list's object every `#on`, and [L138](https://github.com/jashkenas/backbone/blob/6c3d3838e10d5a070f0d1f604fb5c99ed34c8c93/backbone.js#L138) calling `#on` to re-bind callbacks inside `#off`. This fixes jashkenas#3466 and closes jashkenas#3463.
[js perf](http://jsperf.com/backbone-events-linked-list/18) Roughly equivalent performance. Using a linked list allows the events to be mutated by trigger, without skipping an event. This is a **breaking change**. Events used to use a linked list (and switched to an array in jashkenas#1284). But, it performed [very badly](http://jsperf.com/backbone-events-linked-list/8). I'm fairly certain that was due to [L106](https://github.com/jashkenas/backbone/blob/6c3d3838e10d5a070f0d1f604fb5c99ed34c8c93/backbone.js#L106) recreating the linked list's object every `#on`, and [L138](https://github.com/jashkenas/backbone/blob/6c3d3838e10d5a070f0d1f604fb5c99ed34c8c93/backbone.js#L138) calling `#on` to re-bind callbacks inside `#off`. This fixes jashkenas#3466 and closes jashkenas#3463.
Do not alter the "on" events array
[js perf](http://jsperf.com/backbone-events-linked-list/18) Roughly equivalent performance. Using a linked list allows the events to be mutated by trigger, without skipping an event. This is a **breaking change**. Events used to use a linked list (and switched to an array in jashkenas#1284). But, it performed [very badly](http://jsperf.com/backbone-events-linked-list/8). I'm fairly certain that was due to [L106](https://github.com/jashkenas/backbone/blob/6c3d3838e10d5a070f0d1f604fb5c99ed34c8c93/backbone.js#L106) recreating the linked list's object every `#on`, and [L138](https://github.com/jashkenas/backbone/blob/6c3d3838e10d5a070f0d1f604fb5c99ed34c8c93/backbone.js#L138) calling `#on` to re-bind callbacks inside `#off`. This fixes jashkenas#3466 and closes jashkenas#3463.
No description provided.