🌐 AI搜索 & 代理 主页
Skip to content

Conversation

@gibson042
Copy link
Member

Summary

Prevent leftover saved data from async focus/blur from overriding outermost trigger handling.

Fixes gh-4350

Checklist

Copy link
Member

@mgol mgol left a comment

Choose a reason for hiding this comment

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

Nice work! I left some comments but nothing blocking a merge of this.

src/event.js Outdated

// ...and capture the result
dataPriv.set( this, type, jQuery.event.trigger(
dataPriv.set( this, type, { value: jQuery.event.trigger(
Copy link
Member

Choose a reason for hiding this comment

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

Is the change to an object with the value field meant to distinguish the saved object from arguments saved before? Do I understand it right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, exactly.

Copy link
Member

@timmywil timmywil left a comment

Choose a reason for hiding this comment

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

Thanks for getting a PR in so quickly.

@mgol mgol removed the Needs review label Apr 16, 2019
@mgol
Copy link
Member

mgol commented Apr 16, 2019

We'll want to cherry-pick that to master as well.

@mgol mgol added the Event label Apr 16, 2019
@mgol mgol added this to the 3.4.1 milestone Apr 16, 2019
if ( !saved ) {
// Saved data should be false in such cases, but might be a leftover capture object
// from an async native handler (gh-4350)
if ( !saved.length ) {
Copy link

Choose a reason for hiding this comment

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

wouldn't this break in case saved is false (set in dataPriv.set( this, type, false ); on line 570) ?

Copy link
Member

@mgol mgol Apr 17, 2019

Choose a reason for hiding this comment

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

@stof No, it works:

var b = false;
!b.length; // true

This is because for a boolean b b.length will auto-box b into a Boolean instance and then check the length field on it which doesn't exist so b.length will evaluate to undefined. A negation of undefined is true.

I know it's not the most readable code but we care about size and this behavior is covered by tests.

davidbludlow added a commit to graspable/mathquill-webpack that referenced this pull request Apr 25, 2019
because of jquery/jquery#4350 .
This commit should be undone when
jquery/jquery#4354 has made it into the latest
version of jquery (probably jquery version 3.4.1)
davidbludlow added a commit to graspable/mathquill-webpack that referenced this pull request Apr 25, 2019
because of jquery/jquery#4350 .
This commit should be undone when
jquery/jquery#4354 has made it into the latest
version of jquery (probably jquery version 3.4.1)
@mgol mgol merged commit 24d71ac into jquery:3.4-stable Apr 29, 2019
mgol pushed a commit that referenced this pull request Apr 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Development

Successfully merging this pull request may close these issues.

4 participants