Closed AndersDJohnson closed 1 year ago
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?
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?
I meant the pull request; Not your fault, mine. Thanks for adding the tests. I'll do some cross browser testing.
When will this get merged in? Is it ready to go?
Also, cancelable should be false, not true, as per the spec.
@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.
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.
@brian-mann In order to correct cancelable and UIEvent->Event, I think this warrants some refactoring.
@brian-mann I've just pushed some changes in c6a417d that address the above problems (change
is now cancelable and HTMLEvents
instead of UIEvents
).
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?
@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:
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
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.