Bug Tracker

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#9452 closed bug (invalid)

focus event does not bubble correctly

Reported by: anonymous Owned by: anonymous
Priority: undecided Milestone: 1.next
Component: event Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:

Description

Upon focusing an input the event does not bubble up to the parent correctly. I tried in Firefox 4 and Chrome 11. Using the workaround with 'focusin' as I understand is done for IE works properly.

Testcase: http://jsbin.com/uyaho5/3/

Focusing the element should log these six messages:

jQuery focusin, input jQuery focusin, parent native focus, parent native focus, input jQuery focus, parent jQuery focus, input

But the "jQuery focus, parent" is never logged.

Change History (5)

comment:1 Changed 10 years ago by dmethvin

Owner: set to anonymous
Status: newpending

Seems like it is working properly. The focusin and focusout events are the bubbling versions. Or have I misinterpreted the test case?

comment:2 Changed 10 years ago by [email protected]

The question is why the jQuery 'focus' event does not bubble. 'focusin' (and 'focusout') work properly. I don't think it is intentional since the native focus event does bubble. I may have misunderstood something though..

comment:3 Changed 10 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

comment:4 Changed 10 years ago by dmethvin

Component: unfiledevent

Just to follow up, the W3C says that the focus event does not bubble so jQuery is doing the right thing.

http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-eventgroupings-htmlevents

For .live() and .delegate() we currently transform the focus event to focusin so that it will work at all, but I'm not in favor of doing that for .bind() because it will only add to the confusion. If you're doing manual event delegation with .bind() then use the bubbling focusin event.

comment:5 Changed 10 years ago by [email protected]

In light of comment 4 I agree that this bug is indeed invalid. Thanks for the clarification!

Note: See TracTickets for help on using tickets.