-
Notifications
You must be signed in to change notification settings - Fork 20.6k
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
Event: Use only one focusin/out handler per matching window & document #4656
Conversation
0a19d1a
to
2e48489
Compare
|
||
// DOM focus is unreliable in TestSwarm | ||
if ( QUnit.isSwarm && !focus ) { | ||
assert.ok( true, "GAP: Could not observe focus change" ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gibson042 BTW, I copied this from other similar assertions but... what is GAP?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My attempt to make clear that this is not a true passing assertion, but rather a failure to verify the desired assertion at all... a gap between intent and capability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. Since it’s all uppercase, I thought it’s an acronym. 😅
2e48489
to
6f78bba
Compare
… document The `doc` variable in: https://github.com/jquery/jquery/blob/3.4.1/src/event/focusin.js#L30 matched `document` for `document` & `window` for `window`, creating two separate wrapper event handlers & calling handlers twice if at least one `focusout` or `focusin` handler was attached on *both* `window` & `document`, or on `window` & another regular node. Also, fix the "focusin from an iframe" test to actually verify the behavior from commit 1cecf64 - the commit that introduced the regression - to make sure we don't regress on either front.
6f78bba
to
a236eca
Compare
Backport tests from a jQuery 3.x fix that's not needed on `master`. Also, fix the "focusin from an iframe" test to actually verify the behavior from commit 1cecf64 - the commit that introduced the regression - to make sure we don't regress on either front. The main part of the modified test was checking that focusin handling in an iframe works and that's still checked. The test was also checking that it doesn't propagate to the parent document, though, and, apparently, in IE it does. This one test is now blacklisted in IE. (cherry picked from 9e15d6b) (cherry picked from 1a4f10d) Ref jquerygh-4652 Ref jquerygh-4656
Tests backported to |
Backport tests from a jQuery 3.x fix that's not needed on `master`. Also, fix the "focusin from an iframe" test to actually verify the behavior from commit 1cecf64 - the commit that introduced the regression - to make sure we don't regress on either front. The main part of the modified test was checking that focusin handling in an iframe works and that's still checked. The test was also checking that it doesn't propagate to the parent document, though, and, apparently, in IE it does. This one test is now blacklisted in IE. (cherry picked from 9e15d6b) (cherry picked from 1a4f10d) Ref gh-4652 Ref gh-4656 Closes gh-4657
Summary
The
doc
variable in:https://github.com/jquery/jquery/blob/3.4.1/src/event/focusin.js#L30
matched
document
fordocument
&window
forwindow
, creating two separatewrapper event handlers & calling handlers twice if at least one
focusout
orfocusin
handler was attached on bothwindow
&document
, or onwindow
& another regular node.
Also, fix the "focusin from an iframe" test to actually verify the behavior
from commit 1cecf64 - the commit that
introduced the regression - to make sure we don't regress on either front.
+5 bytes.
Test updates should be cherry-picked to
master
without any source changes.Checklist
If needed, a docs issue/PR was created at https://github.com/jquery/api.jquery.com