Skip to main content

Bug Tracker

Side navigation

#12330 closed bug (invalid)

Opened August 17, 2012 02:11PM UTC

Closed August 17, 2012 02:15PM UTC

Last modified August 17, 2012 02:28PM UTC

adding element to parent twice destroys .on(

Reported by: dan.schumann@gmail.com Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:
Description

Hello

I have an $el using backbone

and it has a parent

$('#app').html( $el );

works fine, and keeps events and anything that is $el.on('change', '.child-class', fct);

it breaks though, if I do

$('#app').html( $el );

$('#app').html( $el );

(twice)

Why is this? Each time I'm referencing a jquery element or an html element

Attachments (0)
Change History (3)

Changed August 17, 2012 02:15PM UTC by timmywil comment:1

resolution: → invalid
status: newclosed

Thanks for taking the time to contribute to the jQuery project!

Please ask for support on the forums or the #jquery irc channel. If you mean to report a bug in jQuery core, please provide a complete reduced test case from http://jsFiddle.net or http://jsbin.com using the git("edge") version of jQuery to help us assess your ticket.

Changed August 17, 2012 02:28PM UTC by dmethvin comment:2

Adding the same element to its current position removes data and events. It's an abuse/misunderstanding of .html() in any case.

http://tbranyen.com/post/missing-jquery-events-while-rendering

Changed August 17, 2012 02:28PM UTC by dmethvin comment:3

#12331 is a duplicate of this ticket.