Bug Tracker

Modify

Ticket #4161 (closed bug: duplicate)

Opened 4 years ago

Last modified 4 years ago

Event handlers not preserved when appending to multiple elements

Reported by: dalangalma Owned by: john
Priority: major Milestone: 1.3.2
Component: core Version: 1.3.1
Keywords: Cc:
Blocking: Blocked by:

Description

In jQuery 1.3.1, if you create a new element, attach an event handler to it, and then append it to multiple elements, all but the first copy of the element lose their event handlers. This worked in 1.2.6.

There's a demo at  http://brh.numbera.com/experiments/browserdemos/jquery-1.3.1-append-handlers.html - I've attached a copy to this ticket.

Attachments

jquery-1.3.1-append-handlers.html Download (1.4 KB) - added by dalangalma 4 years ago.
Demo of the bug

Change History

Changed 4 years ago by dalangalma

Demo of the bug

comment:1 Changed 4 years ago by dmethvin

  • Owner set to john

This does seem like a regression. The 1.3.1 domManip is using the DOM cloneNode method which doesn't carry over events. In 1.2.6 it used the jQuery clone method which does.

comment:2 Changed 4 years ago by maranomynet

There's an other important detail about this bug:

In 1.2.6 .append() leaves the source/prototype element intact when appending to multiple target elements...

In 1.3.1 the source/prototype element is always *moved* to the first target element...

See demo attached to ticket #4174

IMO this needs to be fixed as well

comment:3 Changed 4 years ago by john

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

Duplicate of #3966.

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.