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

[CLEANUP] Remove jQuery integration in EventDispatcher #19666

Merged
merged 6 commits into from
Jul 23, 2021

Conversation

simonihmig
Copy link
Contributor

Reopened #19552

@mixonic mixonic mentioned this pull request Jul 19, 2021
58 tasks
assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
} else {
assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
}
Copy link
Member

Choose a reason for hiding this comment

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

Can we assert the presence of event here and event instanceof Event or something?

I believe these two comments apply across the rest of this file and some other files. In the test which isn't for deprecated behavior, please assert the event argument is passed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not only does this totally make sense, but trying to add that assertion uncovered an actual bug, as the event passed was a jQuery event. 😱

The internal components seem do use some additional jQuery related magic, that I was not aware of:

export function jQueryEventShim(target: DeprecatingInternalComponentConstructor): void {
if (JQUERY_INTEGRATION) {
let { prototype } = target;
let superListenerFor = prototype['listenerFor'];
Object.defineProperty(prototype, 'listenerFor', {
configurable: true,
enumerable: false,
value: function listenerFor(this: InternalComponent, name: string): EventListener {
let listener = superListenerFor.call(this, name);
if (jQuery && !jQueryDisabled) {
return (event: Event) => listener(new jQuery.Event(event));
} else {
return listener;
}
},
});
}
}

So this will need some more cleanup...

@rwjblue rwjblue marked this pull request as draft July 21, 2021 15:37
@rwjblue
Copy link
Member

rwjblue commented Jul 21, 2021

FYI - I moved this into draft so I can keep track of where review is needed vs where more work is in progress, please move back out of draft when its ready to review again.

@simonihmig simonihmig force-pushed the remove-jquery-eventdispatcher2 branch from 3175b8c to 0d935ae Compare July 22, 2021 16:10
@simonihmig
Copy link
Contributor Author

Pushed an update:

Note: there are still a few jQuery-related leftovers, like the deprecated feature flag, which are not directly related to the narrower scope of this PR, and which I plan to address in a follow-up PR when this is merged.

@simonihmig simonihmig marked this pull request as ready for review July 22, 2021 16:20
@simonihmig simonihmig requested a review from mixonic July 22, 2021 16:20
@mixonic mixonic merged commit d777bf2 into emberjs:master Jul 23, 2021
@simonihmig simonihmig deleted the remove-jquery-eventdispatcher2 branch July 23, 2021 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants