Bug Tracker

Ticket #14180 (closed bug: fixed)

Opened 15 months ago

Last modified 12 months ago

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

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

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

comment:1 Changed 15 months ago by dmethvin

  • Priority changed from undecided to low
  • Status changed from new to open
  • Component changed from unfiled to event
  • Milestone changed from None to 1.10.3/2.0.4

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

comment:2 Changed 15 months 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 15 months ago by scott.gonzalez

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 15 months 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 14 months ago by dmethvin

  • Milestone changed from 1.10.3/2.0.4 to 1.11/2.1

Bulk update for new milestone

comment:6 Changed 14 months ago by dmethvin

  • Owner set to dmethvin
  • Status changed from open to assigned

comment:7 Changed 12 months ago by Dave Methvin

  • Status changed from assigned to closed
  • Resolution set to fixed

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

Changeset: 9b6f0745805941a6d7b7c16c02cf56ab00021c82

comment:8 Changed 12 months 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 12 months ago by dmethvin

  • Status changed from closed to reopened
  • Resolution fixed deleted

comment:10 Changed 12 months ago by dmethvin

  • Status changed from reopened to open

Did I mention I hate cross-frame focus?

comment:11 Changed 12 months ago by Dave Methvin

  • Status changed from open to closed
  • Resolution set to fixed

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

Changeset: 1cecf64e5aa415367a7dae0b55c2dd17b591442d

comment:12 Changed 12 months ago by Dave Methvin

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

Changeset: c2aca17d457d302cb1683f925b9e5ee93f0984ea

Note: See TracTickets for help on using tickets.