Skip to main content

Bug Tracker

Side navigation

#11338 closed bug (fixed)

Opened February 13, 2012 03:43PM UTC

Closed May 16, 2012 06:04PM UTC

Last modified June 09, 2012 04:57AM UTC

Inconsistent behavior with .replaceWith() and disconnected nodes.

Reported by: https://github.com/ironchefpython Owned by:
Priority: low Milestone: 1.8
Component: manipulation Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:
Description

I noticed odd behavior using replaceWith on disconnected nodes. I use a lot of html fragments, and I was getting strange results depending on the presence or absence of text.

Here is the minimal test case:

> jQuery("<span></span>").replaceWith("<div></div>");
[<div>​</div>​]

>jQuery("<span>foo</span>").replaceWith("<div>bar</div>");
[<span>​foo​</span>​]

This bug may be a duplicate of http://bugs.jquery.com/ticket/7246, however that was closed 15 months ago with no indication of if the non-deterministic behavior is intended.

Attachments (0)
Change History (5)

Changed February 13, 2012 03:48PM UTC by timmywil comment:1

component: unfiledmanipulation
priority: undecidedlow
status: newopen

Changed April 03, 2012 11:17PM UTC by sindresorhus comment:2

Changed May 16, 2012 06:04PM UTC by Oleg comment:3

resolution: → fixed
status: openclosed

Fixes #11338, .replaceWith should work on detached nodes.

Changeset: c04bfce556616a60cecf0ecaf9cb1f9d048a4747

Changed May 16, 2012 06:12PM UTC by dmethvin comment:4

milestone: None1.8

Changed June 09, 2012 04:57AM UTC by ryan.mohr@gmail.com comment:5

This seems like a pretty major regression seeing that this behavior was supposed to be supported in 1.4. Why is this being pushed back to the 1.8 release instead of being released as a patch?