Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#13518 closed bug (notabug)

Possible bug > replaceWith() "messing-up" data/properties of newContent

Reported by: saurabhnanda Owned by: saurabhnanda
Priority: undecided Milestone: None
Component: unfiled Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:


Please take a look at the PoC I've created on Plunker at http://embed.plnkr.co/Fm1ldgRVTpKh2VuoL5dS

The PoC uses AngularJS along with jQuery. When the form is wrapped & unwrapped via jQuery using wrap() & replaceWith() respectively, AngularJS's form related data becomes undefined. However, that is not the case when wrapping/unwrapping is done via native JS.

Use-case: Sliding forms in/out of the user's view via jQuery.Effect, which uses the wrap()/unwrap()/replaceWith() functions.

Change History (4)

comment:1 Changed 9 years ago by Rick Waldron

Owner: set to saurabhnanda
Status: newpending

Thanks for the elaborate use case and for taking the time to contribute to the jQuery project! Please provide a complete _reduced_ test case on jsFiddle to help us assess your ticket!

Additionally, be sure to test against the "jQuery (edge)" version to ensure the issue still exists—you may need to change this to a specific version depending on the test case.

To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to begin.

Also, please read: http://blog.jquery.com/2013/01/15/jquery-1-9-final-jquery-2-0-beta-migrate-final-released/

comment:2 Changed 9 years ago by saurabhnanda

Status: pendingnew

Please take a look at http://jsfiddle.net/qK4PA/1/

I have not removed AngularJS from the dependency because I do not know how else to reproduce the bug. There is a peculiar way in which AngularJS is storing data in a given element, which replaceWith() is probably not retaining during the DOM manipulation.

Also, I had to change the onDomReady to "no wrap (head)" for AngularJS bits to work as expected.

PPS: The Firebug Lite does not show the newly inserted wrapper div, for some reason. Just a heads-up. Try inspecting the DOM using something else.

Last edited 9 years ago by saurabhnanda (previous) (diff)

comment:3 Changed 9 years ago by dmethvin

Resolution: notabug
Status: newclosed

This is really too complex to debug. If you can't reproduce without Angular then it's probably Angular. Ask for help on a forum and if you can reduce the case feel free to open a ticket with more specifics.

Also look at this blog post, it sounds similar: http://tbranyen.com/post/missing-jquery-events-while-rendering

comment:4 Changed 9 years ago by saurabhnanda

Would it be possible to give me some pointers on how to reproduce this without the AngularJS dependency?

Note: See TracTickets for help on using tickets.