Bug Tracker

Opened 13 years ago

Closed 12 years ago

#1545 closed bug (wontfix)

unbind doesn't work if hover uses

Reported by: golden Owned by: davidserduke
Priority: minor Milestone: 1.2.2
Component: event Version: 1.1.4
Keywords: event mouseout hover Cc:
Blocked by: Blocking:

Description

Please see example page:

http://goldenman.spb.ru/development/jquery/bug_unbind/

2 span tags has binded mouseover and mouseout handlers. The first of them uses chain of mouseover, mouseout invokes. The second uses hover method to bind handlers. Then for both tags immediately unbinding of mouseout handler invokes. However for first tag it works proper, but for second it doesn't work.

Attachments (1)

jquery_test.html (1.0 KB) - added by davidserduke 13 years ago.
test case based on how I read the description

Download all attachments as: .zip

Change History (8)

comment:1 Changed 13 years ago by davidserduke

The example page is a broken link so it's difficult to say but this may be related to this ticket about hooking multiple events since hover hooks both mouseout and mouseover.

http://dev.jquery.com/ticket/1731

Changed 13 years ago by davidserduke

Attachment: jquery_test.html added

test case based on how I read the description

comment:2 Changed 13 years ago by davidserduke

Resolution: worksforme
Status: newclosed

The test case I created based on the description works for me. If this test case doesn't reflect the actual bug then please reopen ticket with an appropriate test case.

comment:3 Changed 13 years ago by golden

Resolution: worksforme
Status: closedreopened

Your test case is not completely proper.

$("#s1").unbind("mouseout");
  • this code unbinds all handlers that are binded for this element on this event.

But in my page I tried to unbind only specific handler:

$('#bbb').unbind('mouseout',out); // !!! 2nd parameter important !!!

Please, look on the new sample page:

http://goldenman.spb.ru/development/jquery/bug_unbind/index2.html

comment:4 Changed 13 years ago by davidserduke

Owner: set to davidserduke
Status: reopenednew

Ah I see what you mean. Yes that will fail since hover isn't a true event but rather a helper function. There is currently work being done to make what you want to do possible (if it makes it into the core):

http://groups.google.com/group/jquery-dev/browse_thread/thread/ac05a5cac97913ab#f2e2221786fb0d91

I'll leave the bug open for now and hopefully be able to close it soon. :)

comment:5 Changed 13 years ago by davidserduke

Milestone: 1.21.2.2

comment:6 Changed 12 years ago by brandon

Component: coreevent

comment:7 Changed 12 years ago by davidserduke

Resolution: wontfix
Status: newclosed

The event code has changed so there is now a workaround for this issue. Change

$(...).hover(fnOver, fnOut);

to

$(...).bind('mouseenter.mynamespace', fnOver).bind('mouseleave.mynamespace', fnOut);

That will do the same thing and allow you to namespace the event.

Note: See TracTickets for help on using tickets.