-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix multiple events subscription #1529
Conversation
domNode.addEventListener(event, handler, false); | ||
}); | ||
} | ||
typeof e === 'string'? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's better to do this in very first lines of this function — just check if e
is a string and contains spaces and do forEach
of this.on
(we do similar https://github.com/bem/bem-core/blob/v4/common.blocks/i-bem-dom/__events/i-bem-dom__events.js#L226)
} | ||
}.bind(this); | ||
|
||
typeof e === 'string'? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same stuff like with on
— we can make smaller diff
dcd772d
to
248e7cb
Compare
@veged ⬆️ |
@@ -52,6 +52,14 @@ var undef, | |||
* @returns {EventManager} this | |||
*/ | |||
on : function(e, data, fn, _fnCtx, _isOnce) { | |||
if(typeof e === 'string' && e.indexOf(' ') > -1) { | |||
e.split(' ').forEach(function(evnt) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
evEnt
248e7cb
to
105e5f3
Compare
This PR also addresses #1526 for bem-core version without jQuery.