Skip to content

Conversation

@liady
Copy link

@liady liady commented Apr 27, 2015

Support selector passing in "on" function (optional).
If passed, the handler first checks the event target to match the selector.

@sqal
Copy link

sqal commented Apr 28, 2015

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.

@liady
Copy link
Author

liady commented Apr 28, 2015

Thanks. Changed to a limited "closest" check:
http://jsfiddle.net/q8grdnxa/1/

@sqal
Copy link

sqal commented Apr 28, 2015

👍 Thank you @liady

@sqal
Copy link

sqal commented Apr 30, 2015

I just noticed that $(document).ready event doesn't fire after your changes @liady Can you check what is wrong?

Worse, can't attach single event to element without additional selector parameter

sprint.js Outdated
Copy link

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 :)

@liady
Copy link
Author

liady commented Apr 30, 2015

You're right, I already handled that case but didn't clear the selector variable. Fixed now:
http://jsfiddle.net/q8grdnxa/2/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants