Skip to content
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

Seems to have problems when binding to the event further up the DOM #1

Open
chrisnicola opened this issue Aug 12, 2012 · 1 comment

Comments

@chrisnicola
Copy link

I have a page that loads form elements dynamically after load. In order to catch events fired by these elements I have attached to the event further up the DOM like this:

  $('body').on 'txtinput', '[data-toggle=clear]', (e) ->

However after the first text box I interact with none of the ones I interact with after that fire the event correctly.

I'm using the latest Chrome on OSX.

Tracing through it quickly the problem seems to be with how the event is bound if isSupported(elem) is false using the dlgtTo events. Anyways I'd try for a fix, but give that this library is attempting to be 100% cross-browser compatible I think it might be a bit hard.

Anyways an alternative fallback I've taken the approach of just polling any focused textboxes every 500ms or so. This approach could simply be "skipped" for browser that properly support the new "input" events. It isn't perfect, but it works for most scenarios.

@chrisnicola
Copy link
Author

Here is a Gist of the plugin I've written to solve this for my scenario anyways
https://gist.github.com/3191297

And a link to the blog post about it
http://lucisferre.net/2012/07/27/jquery-plugin-for-really-tracking-text-input-changes/

Would love your feedback on the approach and if there are any pitfalls I'm not recognizing.

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

No branches or pull requests

1 participant