diff options
| author | Vojta Jina | 2011-07-08 01:55:47 +0200 |
|---|---|---|
| committer | Igor Minar | 2011-07-12 23:04:46 -0700 |
| commit | 9ee9ca13da3883d06733637f9048a83d94e6f1f8 (patch) | |
| tree | 127d6d356ce08c447fbd69938d6a75d106b55909 /src | |
| parent | bb39d34279fe1e221d35f5d2a274aaf039ea62d4 (diff) | |
| download | angular.js-9ee9ca13da3883d06733637f9048a83d94e6f1f8.tar.bz2 | |
fix:jqLite: Fix binding to more events separated by space
The var eventHandler was defined outside forEach loop, so registering more
events caused calling listeners registered by the last one.
Regression:
elm.bind('click keyup', callback1);
elm.bind('click', callback2);
elm.bind('keyup', callback3);
Firing click event would have executed callback1, callback3 !
Diffstat (limited to 'src')
| -rw-r--r-- | src/jqLite.js | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/jqLite.js b/src/jqLite.js index a1203739..5e9d777a 100644 --- a/src/jqLite.js +++ b/src/jqLite.js @@ -351,11 +351,10 @@ forEach({ dealoc: JQLiteDealoc, bind: function(element, type, fn){ - var bind = JQLiteData(element, 'bind'), - eventHandler; + var bind = JQLiteData(element, 'bind'); if (!bind) JQLiteData(element, 'bind', bind = {}); forEach(type.split(' '), function(type){ - eventHandler = bind[type]; + var eventHandler = bind[type]; if (!eventHandler) { bind[type] = eventHandler = function(event) { if (!event.preventDefault) { |
