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

add support for UI events, including change #16

Open
wants to merge 4 commits into
base: master
from

Conversation

@AndersDJohnson
Copy link

@AndersDJohnson AndersDJohnson commented Sep 1, 2013

Needed this to emulate native user-driven 'change' event on input elements, at least in Chrome 28, where jQuery's .change() and .trigger('change') failed me.

@mikesherov
Copy link
Member

@mikesherov mikesherov commented Aug 20, 2014

I know this is very old at this point, but thanks for contributing! Would you be able to add some unit tests for this change?

@AndersDJohnson
Copy link
Author

@AndersDJohnson AndersDJohnson commented Aug 21, 2014

Sure - basic unit test added to prove it fires, at least in my browser (Chrome 36.0.1985.143 m, Windows). As for other browsers, I am not sure.

How do you do cross-browser testing? I see some possible jQuery TestSwarm integration, but I'm not sure.

Though it seems to work for now, apparently change is not technically a UIEvent but a generic Event per DOM Level 2 via MDN Event reference. So we could have a generic Event implementation as well, and move change to it instead.

Did you mean this pull request is old, or the project is old?

@mikesherov
Copy link
Member

@mikesherov mikesherov commented Aug 21, 2014

I meant the pull request; Not your fault, mine. Thanks for adding the tests. I'll do some cross browser testing.

@brian-mann
Copy link

@brian-mann brian-mann commented Nov 11, 2014

When will this get merged in? Is it ready to go?

Also, cancelable should be false, not true, as per the spec.

https://developer.mozilla.org/en-US/docs/Web/Events/change

@AndersDJohnson
Copy link
Author

@AndersDJohnson AndersDJohnson commented Nov 11, 2014

@brian-mann Are you asking me or @mikesherov? From my end it worked in Chrome 28-36 when I made the PR, but wasn't tested across various browsers.

Per my earlier comment, I still think it shouldn't be a UIEvent - I can try correct if there is interest.

@brian-mann
Copy link

@brian-mann brian-mann commented Nov 11, 2014

I'm asking @mikesherov since he said he was doing some cross browser testing.

And yes, I believe the event should be HTMLEvents not UIEvent. This is a Dom Level 0 event.

@AndersDJohnson
Copy link
Author

@AndersDJohnson AndersDJohnson commented Nov 11, 2014

@brian-mann In order to correct cancelable and UIEvent->Event, I think this warrants some refactoring.

@AndersDJohnson
Copy link
Author

@AndersDJohnson AndersDJohnson commented Nov 11, 2014

@brian-mann I've just pushed some changes in c6a417d that address the above problems (change is now cancelable and HTMLEvents instead of UIEvents).

@AndersDJohnson AndersDJohnson force-pushed the AndersDJohnson:master branch 2 times, most recently from 38a11d1 to c737641 Nov 11, 2014
@AndersDJohnson AndersDJohnson force-pushed the AndersDJohnson:master branch from c737641 to c6a417d Nov 11, 2014
@mikesherov
Copy link
Member

@mikesherov mikesherov commented Nov 11, 2014

These changes look good, I've just been swamped with other work, and I missed the notifications earlier.

Some of this is a bit over my head, can you give me a short explanation of what firing advantages fire HTMLEvents has over what simulate is currently capable of?

@AndersDJohnson
Copy link
Author

@AndersDJohnson AndersDJohnson commented Nov 11, 2014

@mikesherov There are different kinds of browser events with different APIs. Currently this library supports key (KeyboardEvent) and mouse (MouseEvent) events only, not HTMLEvents such as change. To create these events correctly in a programmatic fashion, we need to add mappings from the event name strings to the correct event type interface.

See:

@jzaefferer
Copy link
Member

@jzaefferer jzaefferer commented Feb 12, 2015

Thank you for the contribution. As you've probably guessed already, this project isn't well maintained. I've added some details about that here: https://github.com/jquery/jquery-simulate#project-status

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

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.