Permalink
Browse files

Optimize `Event.stopObserving`.

  • Loading branch information...
1 parent 7c26a1e commit 849bcee4a334a0c601675123266b0f0da9fdfcaa @savetheclocktower savetheclocktower committed Nov 5, 2010
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/dom/event.js
View
@@ -854,8 +854,14 @@
});
return element;
}
-
- var responder = responders.find( function(r) { return r.handler === handler; });
+
+ var i = responders.length, responder;
+ while (i--) {
+ if (responders[i].handler === handler) {
+ responder = responders[i];
+ break;
+ }
+ }
if (!responder) return element;
if (eventName.include(':')) {

0 comments on commit 849bcee

Please sign in to comment.