Skip to main content

Bug Tracker

Side navigation

#11076 closed bug (fixed)

Opened December 20, 2011 03:11PM UTC

Closed January 28, 2012 09:57PM UTC

Last modified March 08, 2012 11:53PM UTC

.clone(true) loses delegation filters

Reported by: Owned by: dmethvin
Priority: high Milestone: 1.7.2
Component: event Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:


is set on a node, and the node or one of its ancestors is cloned with
, in jQuery 1.7 the delegate's object filter is not conserved and the delegate is transformed in a normal "click" event.

(in both test cases, top table is original and bottom table is cloned one)

1.6.4, correct behavior

  • clicking on "head" cell prints "row" in both tables
  • clicking on any "cell" cell prints "cell" in both tables
  • clicking on "last" cell prints "last" in both tables

1.7.1, incorrect behavior

  • first table (original) behaves as above
  • second table (clone) prints all of "last", "cell" and "row" when clicking on any of the table's cells.

note: adding a second

has no effect (and no reason to have any, since we're only losing metadata not the events themselves)

Attachments (0)
Change History (2)

Changed December 20, 2011 03:32PM UTC by dmethvin comment:1

component: unfiledevent
milestone: None1.7.2
owner: → dmethvin
priority: undecidedhigh
status: newassigned

Excellent test case and description, thanks! Yes, cloneCopyEvent() isn't setting the selector properly.

Changed January 28, 2012 09:57PM UTC by Dave Methvin comment:2

resolution: → fixed
status: assignedclosed

Fix #11076. If .clone() won't delegate, we must remediate.

Since jQuery.event.add can accept a handleObj there's no need to reiterate them as args, but we *do* need to set the selector variable correctly.

Changeset: 633ca9c1610c49dbb780e565f4f1202e1fe20fae