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

Convenience events for focusin/out etc with poor cross-brower support #128

Closed
dominicwhittle opened this issue Jun 20, 2016 · 6 comments
Closed
Labels

Comments

@dominicwhittle
Copy link

dominicwhittle commented Jun 20, 2016

Are there plans to polyfil any common events?
Theres some inconsistency in current browser input event listeners; eg focusin and focusout vs focus and blur etc

If not, then how about following jQuery's API in which you can spec multiple space-separated event types?

$el.on('focusin blur whatevs', 'input', callbackFn)
// ^ works in jQuery, not Cash
@shshaw
Copy link
Collaborator

shshaw commented Jun 20, 2016

Event retooling is one of the biggest changes planned for the next version, mainly fixing some delegate support ( #114 ) and allowing for namespaces ( #121 ). Registering multiple events per callback/delegate shouldn't be a problem.

I'm not sure specifically what you mean by polyfilling common events. Are you referring to inconsistencies between browsers about when focusout is triggered versus blur?

@dominicwhittle
Copy link
Author

Cool.

Are you referring to inconsistencies between browsers about when focusout is triggered versus blur

That's right. I was wondering if there were plans to account for some of the subtle inconsistencies in events that jQuery seamlessly irons out. I do appreciate that the size of Cash should be a major consideration in any feature like this; eg,

$(input).on('focusin', onFocus) // Chrome, Safari, IE
$(intput)[0].addEventListener('focus', onFocus, {useCapture: true}) // Firefox

function onFocus (e) { 
  // do stuff on focus 
}

@shshaw
Copy link
Collaborator

shshaw commented Jun 20, 2016

Haven't specifically encountered these bugs. Is it only with focusin/focusout that you're having difficulty?

Seems like jQuery is mainly fixing focusin/focusout and blur:
https://github.com/jquery/jquery/blob/master/src/event/focusin.js

With a few small fixes for click and load
https://github.com/jquery/jquery/blob/master/src/event.js#L442-L494

@dominicwhittle
Copy link
Author

dominicwhittle commented Jun 20, 2016

It's not a bug so to speak, just that (as you say) focusin/focusout aren't supported in Firefox, so I'm having to resort to vanilla javascript to handle that via addEventListener. It's really not a big deal, but given this is an inconsistency in current browsers it might be worth considering "fixing" that browser inconsistency in Cash.

@shshaw shshaw added the bug label Jun 20, 2016
@shshaw shshaw added this to the 1.4.0 milestone Jun 20, 2016
@fabiospampinato fabiospampinato removed this from the 1.4.0 milestone May 11, 2018
@fabiospampinato
Copy link
Owner

If not, then how about following jQuery's API in which you can spec multiple space-separated event types?

This is implemented as of v2.1.2.

Regarding ironing out differences between browsers, it sounds like a very difficult task to do properly (especially while still supporting IE9+), and the size of the bundle could increase substantially.

@fabiospampinato
Copy link
Owner

fabiospampinato commented Nov 20, 2018

Closing as this shouldn't be an issue anymore since Firefox v52 (~13 versions ago).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants