- Notifications
You must be signed in to change notification settings - Fork20.5k
Event: Use only one focusin/out handler per matching window & document#4656
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
0a19d1a to2e48489Compare| // 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... agap 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 to6f78bbaCompare… documentThe `doc` variable in:https://github.com/jquery/jquery/blob/3.4.1/src/event/focusin.js#L30matched `document` for `document` & `window` for `window`, creating two separatewrapper 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 behaviorfrom commit1cecf64 - the commit thatintroduced the regression - to make sure we don't regress on either front.
6f78bba toa236ecaCompareBackport 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 behaviorfrom commit1cecf64 - the commit thatintroduced 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 aniframe works and that's still checked. The test was also checking that itdoesn't propagate to the parent document, though, and, apparently, in IE itdoes. This one test is now blacklisted in IE.(cherry picked from9e15d6b)(cherry picked from1a4f10d)Refjquerygh-4652Refjquerygh-4656
mgol commentedApr 6, 2020
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 behaviorfrom commit1cecf64 - the commit thatintroduced 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 aniframe works and that's still checked. The test was also checking that itdoesn't propagate to the parent document, though, and, apparently, in IE itdoes. This one test is now blacklisted in IE.(cherry picked from9e15d6b)(cherry picked from1a4f10d)Refgh-4652Refgh-4656Closesgh-4657
Summary
The
docvariable in:https://github.com/jquery/jquery/blob/3.4.1/src/event/focusin.js#L30
matched
documentfordocument&windowforwindow, creating two separatewrapper event handlers & calling handlers twice if at least one
focusoutorfocusinhandler was attached onbothwindow&document, or onwindow& another regular node.
Also, fix the "focusin from an iframe" test to actually verify the behavior
from commit1cecf64 - 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
masterwithout any source changes.Checklist
If needed, a docs issue/PR was created athttps://github.com/jquery/api.jquery.com