commit cf857678085f3bff0ad88614794427e50d42ee51
parent 31202186133df414fb5148bbc33889be1d21d21e
Author: Ryan Wolf <rwolf@borderstylo.com>
Date: Fri, 4 Feb 2011 17:18:40 -0800
$().ubind did not properly handle arguments in the form $().unbind(event)
Diffstat:
1 file changed, 12 insertions(+), 0 deletions(-)
diff --git a/windex.js b/windex.js
@@ -612,6 +612,7 @@ WindexNodes.prototype.bind = function (name, handler) {
// See: http://api.jquery.com/unbind
WindexNodes.prototype.unbind = function (name, handler) {
if (!name) { return this._unbindAll(); }
+ if (!handler) { return this._unbindEventAll(name); }
return this._unbindEvent(name, handler);
}
@@ -627,6 +628,17 @@ WindexNodes.prototype._unbindAll = function () {
return this;
};
+WindexNodes.prototype._unbindEventAll = function (name) {
+ this.forEach(function (node) {
+ if (!events[node] || !events[node][name]) return;
+ events[node][name].forEach(function (bridge) {
+ node.removeEventListener(name, bridge.wrapped, false);
+ });
+ delete events[node][name];
+ });
+ return this;
+};
+
WindexNodes.prototype._unbindEvent = function (name, handler) {
this.forEach(function (node) {
if (!events[node] || !events[node][name]) return;