Bug Tracker

Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#14180 closed bug (fixed)

focusin/out special events don't work cross-window

Reported by: scottgonzalez Owned by: dmethvin
Priority: low Milestone: 1.11/2.1
Component: event Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:

Description

The special event implementation for focusin/out refer to the global document instead of the owner document of the element the event handler is being added to.

Change History (12)

comment:1 Changed 4 years ago by dmethvin

Component: unfiledevent
Milestone: None1.10.3/2.0.4
Priority: undecidedlow
Status: newopen

This seems easily fixable if we use data on the document rather than a single variable in the closure.

comment:2 Changed 4 years ago by dmethvin

Although...what is the use case for this? If the event is in an iframe it will have to be in the same domain. If the iframe is navigated we will leak the event data.

comment:3 Changed 4 years ago by scottgonzalez

jQuery UI dialogs bind to focusin on the document when a modal dialog is opened. If the user does something like $( otherWindow ).find( "#dialog" ).dialog({ modal: true }) then our event handler is listening on the wrong document.

Leaking data does seem like a concern. But I think this is uncommon enough that if someone runs into this problem and they're leaking a considerable amount of data (what could they possibly be doing with that many event handlers cross document?) it'd be easy enough for them to work around by explicitly unbinding.

comment:4 Changed 4 years ago by dmethvin

Yeah they'll have to explicitly unbind. For example if the iframe is part of an MVC view that is updated via a bulk .html(), the jQuery.cleanData() that precedes it won't venture into the iframe contents and find the attached event.

I'll try my hand at creating a unit test for this but I may give up, focus tests are the most notoriously unreliable.

comment:5 Changed 4 years ago by dmethvin

Milestone: 1.10.3/2.0.41.11/2.1

Bulk update for new milestone

comment:6 Changed 4 years ago by dmethvin

Owner: set to dmethvin
Status: openassigned

comment:7 Changed 4 years ago by Dave Methvin

Resolution: fixed
Status: assignedclosed

Fix #14180. Allow cross-frame use of focusin/out. Close gh-1369.

Changeset: 9b6f0745805941a6d7b7c16c02cf56ab00021c82

comment:8 Changed 4 years ago by Dave Methvin

Revert "Fix #14180. Allow cross-frame use of focusin/out. Close gh-1369."

This reverts commit 9b6f0745805941a6d7b7c16c02cf56ab00021c82.

Changeset: eca79fbf5b79d85d137a8eb207fcb1431af47d4e

comment:9 Changed 4 years ago by dmethvin

Resolution: fixed
Status: closedreopened

comment:10 Changed 4 years ago by dmethvin

Status: reopenedopen

Did I mention I hate cross-frame focus?

comment:11 Changed 3 years ago by Dave Methvin

Resolution: fixed
Status: openclosed

Fix #14180. Allow cross-frame use of focusin/out. Close gh-1369.

Changeset: 1cecf64e5aa415367a7dae0b55c2dd17b591442d

comment:12 Changed 3 years ago by Dave Methvin

Ref #14180, let focusin/out work on non-element targets.

Changeset: c2aca17d457d302cb1683f925b9e5ee93f0984ea

Note: See TracTickets for help on using tickets.