Bug Tracker

Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#5566 closed bug (fixed)

domManip fails to copy events when cloning elements

Reported by: dalangalma Owned by: snover
Priority: blocker Milestone: 1.5
Component: manipulation Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:

Description

I am creating a "button" element, adding a click handler to it, then attaching it to every one of multiple "li" elements by selecting all of the "li"s and appending the "button" element. When I do that, none of the buttons retain their click element. This worked in jQuery 1.2.6, then broke in 1.3.1 (see #3966 and #4161). I've verified the problem with the attached demo in jQuery 1.3.2 and a build from GitHub from 11/29/09.

Attachments (2)

jquery-1.3.2-append-handlers.html (1.5 KB) - added by dalangalma 14 years ago.
Test case for the bug.
test-5566.html (1.5 KB) - added by dmethvin 14 years ago.
Slightly modified test case

Download all attachments as: .zip

Change History (15)

Changed 14 years ago by dalangalma

Test case for the bug.

comment:2 Changed 14 years ago by dmethvin

Still a problem in 1.4a1. domManip uses DOM cloneNode when appending to multiple elements, that looks like where the events are dropped. It looks like cloneCopyEvent might come in handy.

Changed 14 years ago by dmethvin

Attachment: test-5566.html added

Slightly modified test case

comment:3 Changed 13 years ago by dalangalma

This is still broken on 1.4.4 though by now it's been regressed for so long that maybe the docs just need to be updated.

comment:4 Changed 13 years ago by snover

Milestone: 1.41.5
Priority: majorblocker
Status: newopen
Version: 1.3.21.4.4

This should work.

comment:5 Changed 13 years ago by snover

#6997 is a duplicate of this ticket.

comment:6 Changed 13 years ago by snover

Component: coremanipulation
Milestone: 1.51.4.5
Owner: set to snover
Status: openassigned
Summary: Can't create an element, assign an event handler, then append it to multiple elements.domManip fails to copy events when cloning elements

comment:8 Changed 13 years ago by john

Resolution: fixed
Status: assignedclosed

Landed.

comment:9 Changed 13 years ago by jeresig

Backing out cec68e2b00d86357c18b576cbaed52cc1ea42a74, was causing serialize tests to fail. Un-fixes #5566.

Changeset: 29616e60c88bf300f4b2ee4ad1a89a8ac6481027

comment:10 Changed 13 years ago by john

Resolution: fixed
Status: closedreopened

comment:11 Changed 13 years ago by Colin Snover

Resolution: fixed
Status: reopenedclosed

Merge branch 'bug5566' into csnover-bug5566. Fixes #4386, #5566, #6997.

Conflicts:

src/manipulation.js test/unit/manipulation.js

Changeset: 4fae75d575b20d887e4a273c7991c55f8821a62c

comment:7 Changed 13 years ago by snover

#4383 is a duplicate of this ticket.

comment:8 Changed 13 years ago by jitter

Milestone: 1.4.51.5

Move fixed tickets to appropriate milestone

Note: See TracTickets for help on using tickets.