Skip to main content

Bug Tracker

Side navigation

#10415 closed feature (invalid)

Opened October 04, 2011 09:19AM UTC

Closed October 04, 2011 01:12PM UTC

Last modified October 09, 2011 02:09AM UTC

Multiple selectors in live, die, delegate and undelegate

Reported by: icebits@yahoo.com Owned by:
Priority: low Milestone: None
Component: event Version: 1.6.4
Keywords: Cc:
Blocked by: Blocking:
Description

Is current release support multiple selectors in live, die, delegate and undelegate? I have tested to bind multiple id with live and delegate seem acceptable but then use die or undelegate to remove the binded behaviour seem not working.

Test case at http://jsfiddle.net/6DURW/

Thank you.

Attachments (0)
Change History (5)

Changed October 04, 2011 01:12PM UTC by timmywil comment:1

component: unfiledevent
priority: undecidedlow
resolution: → invalid
status: newclosed

Checked in Chrome and IE6: http://jsfiddle.net/timmywil/6DURW/2/

Changed October 04, 2011 01:57PM UTC by icebits@yahoo.com comment:2

Replying to [comment:1 timmywil]:

Checked in Chrome and IE6: http://jsfiddle.net/timmywil/6DURW/2/

Hi, sorry to disturb, I am not really understand. How do I unbind using undelegate for delegated event? From my example, I have delegated 2 id (#ccc,#ddd) for click event but then undelegate one of the id (#ddd), but the result, undelegated id (#ddd) still have delegate behavior (the click event). The bind/unbind seem don't have that issue.

Changed October 04, 2011 02:56PM UTC by timmywil comment:3

I understand. I'm saying I cannot reproduce that in Chrome or IE6. Is there another browser where this is an issue?

Changed October 05, 2011 08:33AM UTC by icebits@yahoo.com comment:4

Thanks for your prompt reply. I had tried to run the code again with Chrome 14.0.835.202, Firefox 7.01 and Internet Explorer 9 on Win7 Pro x86 SP1. I am still getting same result, from my example, the button with id "ddd" still has the delegated event. Is that a change that I am written wrong syntax to undelegate event? Sorry to disturb and thank you again for your time.

Changed October 09, 2011 02:09AM UTC by dmethvin comment:5

The selector must match *exactly* in the delegate() and undelegate() calls.

// WRONG
$("#a").delegate(".b, .c", "click", fn);
$("#a").undelegate(".b", "click");
// RIGHT
$("#a").delegate(".b", "click", fn);
$("#a").delegate(".c", "click", fn);
$("#a").undelegate(".b", "click");