[Pkg-javascript-commits] [backbone] 146/173: When listening to numerous events and stopListening is called, then _.isEmpty is painfully slowly and assigning _listenTo to undefined isn't necessary.
Jonas Smedegaard
dr at jones.dk
Wed Aug 31 07:44:14 UTC 2016
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository backbone.
commit 32d89dc47ebaff30ad247724c0c3410de1fe39aa
Author: Ash Lux <ashlux at gmail.com>
Date: Thu Dec 10 21:37:04 2015 -0600
When listening to numerous events and stopListening is called, then _.isEmpty is painfully slowly and assigning _listenTo to undefined isn't necessary.
---
backbone.js | 3 +--
test/collection.js | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/backbone.js b/backbone.js
index d422f52..d0cad3e 100644
--- a/backbone.js
+++ b/backbone.js
@@ -242,7 +242,6 @@
listening.obj.off(name, callback, this);
}
- if (_.isEmpty(listeningTo)) this._listeningTo = void 0;
return this;
};
@@ -299,7 +298,7 @@
delete events[name];
}
}
- if (_.size(events)) return events;
+ return events;
};
// Bind an event to only be triggered a single time. After the first time
diff --git a/test/collection.js b/test/collection.js
index 8a8d536..a0f6bf6 100644
--- a/test/collection.js
+++ b/test/collection.js
@@ -1578,7 +1578,7 @@
});
QUnit.test('_addReference binds all collection events & adds to the lookup hashes', function(assert) {
- assert.expect(9);
+ assert.expect(8);
var calls = {add: 0, remove: 0};
@@ -1598,7 +1598,6 @@
assert.equal(this._byId[model.id], void 0);
assert.equal(this._byId[model.cid], void 0);
assert.equal(model.collection, void 0);
- assert.equal(model._events, void 0);
}
});
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/backbone.git
More information about the Pkg-javascript-commits
mailing list