Bug Tracker

Modify

Ticket #5935 (closed bug: invalid)

Opened 3 years ago

Last modified 3 years ago

Attached events is lost on empty()

Reported by: petter@… Owned by:
Priority: trivial Milestone:
Component: core Version: 1.4
Keywords: eventhandling empty Cc:
Blocking: Blocked by:

Description

This might not be a bug, but i'm filing it here anyway...

$("selector").click(doSomething);

works fine ofcours..

But if I take an element that has this event attached, moves and does

$("#someElement").append(someElementWithClick); the click event still works on both elements.

But if I do $("#someElement").empty(); the click event is removed from the original element..

The problem is solved by adding a .clone() $("#someElement").append(someElementWithClick.clone());

So I'm not sure if this is a bug or a feature.. :)

Change History

comment:1 Changed 3 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

Can you put together a complete test case and reopen with an attachment? Thanks!

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.