support selector in 'on' function
Support selector passing in "on" function (optional). If passed, the handler first checks the event target to match the selector.
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: http://jsfiddle.net/q8grdnxa/1/
:+1: Thank you @liady
~~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
You're right, I already handled that case but didn't clear the selector variable. Fixed now: http://jsfiddle.net/q8grdnxa/2/