-
Notifications
You must be signed in to change notification settings - Fork 163
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
support selector in 'on' function #20
base: master
Are you sure you want to change the base?
Conversation
This is not working as it should, Check out demo: http://jsfiddle.net/q8grdnxa/ It should detect if user clicks on any element within delegated element. |
Thanks. Changed to a limited "closest" check: |
👍 Thank you @liady |
Worse, can't attach single event to element without additional selector parameter |
// .on(events, handler) | ||
if (handler) { | ||
if(selector){ |
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.
There needs to be check if selector is a string, because if user do not pass selector it becomes a handler function which evaluates to true ofc :)
You're right, I already handled that case but didn't clear the selector variable. Fixed now: |
Support selector passing in "on" function (optional).
If passed, the handler first checks the event target to match the selector.