Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

Commit 8e33d67

Browse files
committed
optimize unbind
R=arv BUG= Review URL: https://codereview.appspot.com/13527046
1 parent a482404 commit 8e33d67

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/NodeBind.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,14 @@
5050
};
5151

5252
Node.prototype.unbind = function(name) {
53-
this.bindings = this.bindings || {};
53+
if (!this.bindings)
54+
this.bindings = {};
55+
if (!this.bindings[name])
56+
return;
5457
var binding = this.bindings[name];
5558
if (binding && typeof binding.close === 'function')
5659
binding.close();
57-
delete this.bindings[name];
60+
this.bindings[name] = undefined;
5861
};
5962

6063
Node.prototype.unbindAll = function() {

0 commit comments

Comments
 (0)