Bug Tracker

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#10415 closed feature (invalid)

Multiple selectors in live, die, delegate and undelegate

Reported by: icebits@… 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.

Change History (5)

comment:1 Changed 7 years ago by timmywil

Component: unfiledevent
Priority: undecidedlow
Resolution: invalid
Status: newclosed

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

comment:2 in reply to:  1 Changed 7 years ago by icebits@…

Replying to 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.

comment:3 Changed 7 years ago by timmywil

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

comment:4 in reply to:  3 Changed 7 years ago by icebits@…

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.

comment:5 Changed 7 years ago by dmethvin

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");
Note: See TracTickets for help on using tickets.