Skip to main content

Bug Tracker

Side navigation

#1545 closed bug (wontfix)

Opened August 28, 2007 11:03AM UTC

Closed December 16, 2007 08:47PM UTC

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 November 18, 2007 11:47PM UTC.

    test case based on how I read the description

Change History (7)

Changed September 27, 2007 10:22PM UTC by davidserduke comment:1

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 November 18, 2007 11:50PM UTC by davidserduke comment:2

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.

Changed November 27, 2007 04:07PM UTC by golden comment:3

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

Changed November 27, 2007 06:27PM UTC by davidserduke comment:4

owner: → 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. :)

Changed November 27, 2007 06:27PM UTC by davidserduke comment:5

milestone: 1.21.2.2

Changed December 07, 2007 04:16AM UTC by brandon comment:6

component: coreevent

Changed December 16, 2007 08:47PM UTC by davidserduke comment:7

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.