Skip to main content

Bug Tracker

Side navigation

#13518 closed bug (notabug)

Opened February 25, 2013 06:52PM UTC

Closed February 26, 2013 03:14AM UTC

Last modified February 26, 2013 06:49AM UTC

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:
Description

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.

Attachments (0)
Change History (4)

Changed February 25, 2013 06:56PM UTC by rwaldron comment:1

owner: → 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/

Changed February 26, 2013 02:58AM UTC by saurabhnanda comment:2

_comment0: 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.1361847584539310
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.

Changed February 26, 2013 03:14AM UTC by dmethvin comment:3

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

Changed February 26, 2013 06:49AM UTC by saurabhnanda comment:4

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