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

JQuery event & RiotJS #2150

Closed
pgoergler opened this Issue Dec 9, 2016 · 4 comments

Comments

Projects
None yet
3 participants
@pgoergler

pgoergler commented Dec 9, 2016

Help us to manage our issues by answering the following:

  1. Describe your issue:

How can i work with JQuery AND RiotJS ?

With <input id="my_input" onchange={myRiotTagFunction} /> and jQuery $('#my_input').trigger('change')
myRiotTagFunction is not called.

This only happens with RiotJS 3.x, with RiotJS 2.6.7, every thing work fine.
What should i do, to make it work with RiotJS 3.x

  1. Can you reproduce the issue?

I made a Plnkr to check what happened.
jQuery do not work with internal EventListener, so i think RiotJS 3.x use EventListener now to bind events ?

  1. On which browser/OS does the issue appear?
    all

  2. Which version of Riot does it affect?
    RiotJS 3.x

  3. How would you tag this issue?

  • Question
  • Bug
  • Discussion
  • Feature request
  • Tip
  • Enhancement
  • Performance
@continuata

This comment has been minimized.

Show comment
Hide comment
@continuata

continuata Jan 9, 2017

Contributor

We have this rather alarming issue too in upgrading from 2.x -> 3.x
... a total nightmare for us, lots of our tests now fail because we can't trigger JQuery events.

Is Riot3 not compatible with JQuery?
How are you supposed to test Tags in Riot3?

Contributor

continuata commented Jan 9, 2017

We have this rather alarming issue too in upgrading from 2.x -> 3.x
... a total nightmare for us, lots of our tests now fail because we can't trigger JQuery events.

Is Riot3 not compatible with JQuery?
How are you supposed to test Tags in Riot3?

@GianlucaGuarini

This comment has been minimized.

Show comment
Hide comment
@GianlucaGuarini

GianlucaGuarini Jan 9, 2017

Member

Riot 3 sticks to the standards using DOM Events api level 3.
We are not responsible for what jQuery does and how it internally handles js DOM events, we can rely only on the w3c specs addEventListener('eventName', callback)
For all the jQuery issues on non standard javascript APIs please contact directly the jQuery team

How can i work with JQuery AND RiotJS ?

Starting from the fact that $('#my_input').trigger('change') is an extremely poor example of code per admission of the jQuery team. You can use the jquery api to listen all the events the DOM events and combine the jquery events with the riot ones (standard dom events)

Is Riot3 not compatible with JQuery?

no, riot is compatible with any DOM library jQuery included (see my example above)

How are you supposed to test Tags in Riot3?

Demonstrated in here using 3 lines function helper
Eventually you can use jquery

Member

GianlucaGuarini commented Jan 9, 2017

Riot 3 sticks to the standards using DOM Events api level 3.
We are not responsible for what jQuery does and how it internally handles js DOM events, we can rely only on the w3c specs addEventListener('eventName', callback)
For all the jQuery issues on non standard javascript APIs please contact directly the jQuery team

How can i work with JQuery AND RiotJS ?

Starting from the fact that $('#my_input').trigger('change') is an extremely poor example of code per admission of the jQuery team. You can use the jquery api to listen all the events the DOM events and combine the jquery events with the riot ones (standard dom events)

Is Riot3 not compatible with JQuery?

no, riot is compatible with any DOM library jQuery included (see my example above)

How are you supposed to test Tags in Riot3?

Demonstrated in here using 3 lines function helper
Eventually you can use jquery

@continuata

This comment has been minimized.

Show comment
Hide comment
@continuata

continuata Jan 10, 2017

Contributor

but, this is a breaking change for people who have been using $('#id').click() to test event-triggered methods in Riot2. Probably worth mentioning this in the upgrade docs as a breaking change.

JQuery may not feel that's the best way; but I prefer that to creating a separate wrapper function whose only purpose is to handle the event object and abstract the rest of the code for running from tests.
We have way too many tests using the JQuery click to refactor them in this sprint, so I'm going to have to revert all the upgrade stuff back to Riot2 and look at this again later.

Contributor

continuata commented Jan 10, 2017

but, this is a breaking change for people who have been using $('#id').click() to test event-triggered methods in Riot2. Probably worth mentioning this in the upgrade docs as a breaking change.

JQuery may not feel that's the best way; but I prefer that to creating a separate wrapper function whose only purpose is to handle the event object and abstract the rest of the code for running from tests.
We have way too many tests using the JQuery click to refactor them in this sprint, so I'm going to have to revert all the upgrade stuff back to Riot2 and look at this again later.

@GianlucaGuarini

This comment has been minimized.

Show comment
Hide comment
@GianlucaGuarini

GianlucaGuarini Jan 10, 2017

Member

@continuata it's a great idea I will update the doc on the next release

Member

GianlucaGuarini commented Jan 10, 2017

@continuata it's a great idea I will update the doc on the next release

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