sprint icon indicating copy to clipboard operation
sprint copied to clipboard

support selector in 'on' function

Open liady opened this issue 10 years ago • 5 comments

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

liady avatar Apr 27 '15 13:04 liady

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.

sqal avatar Apr 28 '15 13:04 sqal

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

liady avatar Apr 28 '15 16:04 liady

:+1: Thank you @liady

sqal avatar Apr 28 '15 17:04 sqal

~~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

sqal avatar Apr 30 '15 20:04 sqal

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

liady avatar Apr 30 '15 22:04 liady