Skip to main content

Bug Tracker

Side navigation

#14180 closed bug (fixed)

Opened July 24, 2013 01:51PM UTC

Closed November 13, 2013 02:22AM UTC

Last modified November 14, 2013 09:35PM UTC

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.

Attachments (0)
Change History (12)

Changed July 24, 2013 02:34PM UTC by dmethvin comment:1

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.

Changed July 25, 2013 08:57PM UTC by dmethvin comment:2

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.

Changed July 25, 2013 09:27PM UTC by scottgonzalez comment:3

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.

Changed July 25, 2013 10:02PM UTC by dmethvin comment:4

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.

Changed September 16, 2013 01:21AM UTC by dmethvin comment:5

milestone: 1.10.3/2.0.41.11/2.1

Bulk update for new milestone

Changed September 17, 2013 02:16PM UTC by dmethvin comment:6

owner: → dmethvin
status: openassigned

Changed October 23, 2013 02:03AM UTC by Dave Methvin comment:7

resolution: → fixed
status: assignedclosed

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

Changeset: 9b6f0745805941a6d7b7c16c02cf56ab00021c82

Changed October 23, 2013 02:49AM UTC by Dave Methvin comment:8

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

This reverts commit 9b6f0745805941a6d7b7c16c02cf56ab00021c82.

Changeset: eca79fbf5b79d85d137a8eb207fcb1431af47d4e

Changed October 23, 2013 02:50AM UTC by dmethvin comment:9

resolution: fixed
status: closedreopened

Changed October 23, 2013 02:51AM UTC by dmethvin comment:10

status: reopenedopen

Did I mention I hate cross-frame focus?

Changed November 13, 2013 02:22AM UTC by Dave Methvin comment:11

resolution: → fixed
status: openclosed

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

Changeset: 1cecf64e5aa415367a7dae0b55c2dd17b591442d

Changed November 14, 2013 09:35PM UTC by Dave Methvin comment:12

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

Changeset: c2aca17d457d302cb1683f925b9e5ee93f0984ea