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

Trigger 'input' event before 'change' events #4649

Merged
merged 1 commit into from Jan 28, 2020

Conversation

marcandre
Copy link
Contributor

This pull request includes a

  • Bug fix
  • New feature
  • Translation

The following changes were made

  • Triggers an input event before triggering a change event
  • Tests looking for change event being triggered now look for input then change.

While not widely known, the input event is triggered before all change events for inputs and selects (see the spec here)

FWIW, Parsley relies on the input event, so the current code is causing bad interactions

Copy link
Member

@kevin-brown kevin-brown left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear under what cases the input event is fired. Is there a use case for the input event that is not dependent on the change event, or is one basically a copy of the other?

changeTriggered,
'The change event should be triggered'
'The change event should be triggered after the input event'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how I feel about enforcing the order of the events within past tests. I can understand adding tests to check that the input event is triggered, and adding tests to ensure that one event is caught before the other, but I don't think that requires you to modify old change-only tests to cover both those cases.

@marcandre
Copy link
Contributor Author

marcandre commented Nov 14, 2016

Thanks for taking a look at this PR 😄

  1. Every change event should be preceded by at least one input event. Most inputs have a single input event triggered just before a change event, but some like type="text" usually have many input events (e.g. after each key / paste / ...) before a single change event (when loosing focus). Another input with multiple input events before each change is the type="color".

  2. For tests, we could have one test to insure that change is triggered, another to check that input is triggered, and a third one to insure that they are triggered in the right order, but the first two are made redundant by the third one so that why I felt this was the best solution. Note that the order of the event is mandated by the spec.

Let me know how I can be of further assistance

@marcandre
Copy link
Contributor Author

@kevin-brown Is there something else that is blocking this PR from being merged?

@marcandre
Copy link
Contributor Author

I've rebased my branch.

@stale
Copy link

stale bot commented Mar 13, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the status: stale label Mar 13, 2019
@marcandre
Copy link
Contributor Author

This PR is really simple, and is still valid.

@stale
Copy link

stale bot commented May 12, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the status: stale label May 12, 2019
@marcandre
Copy link
Contributor Author

This PR is really simple, and is still valid.

@stale stale bot removed the status: stale label May 12, 2019
@Marco-Sulla
Copy link

Please merge this pull request, is simple and adhere to the standards

@stale
Copy link

stale bot commented Jul 11, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the status: stale label Jul 11, 2019
@marcandre
Copy link
Contributor Author

Stale bot: 0
Me: 2

@stale
Copy link

stale bot commented Sep 9, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@marcandre
Copy link
Contributor Author

Rebased.

@kevin-brown kevin-brown added this to the 4.0.12 milestone Oct 14, 2019
@kevin-brown kevin-brown changed the base branch from master to develop October 14, 2019 03:02
@kevin-brown kevin-brown modified the milestones: 4.0.12, 4.0.13 Nov 6, 2019
@edwinvdpol
Copy link

Ow come on, merge already!! 👍

@kevin-brown
Copy link
Member

Rebased this pull request against the latest dev so the new checks can run. The goal of this is to get it merged in tonight for the next patch release.

@kevin-brown kevin-brown merged commit 42364b1 into select2:develop Jan 28, 2020
@marcandre
Copy link
Contributor Author

Cool, thanks!

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

Successfully merging this pull request may close these issues.

None yet

4 participants