Skip to main content

Bug Tracker

Side navigation

#13001 closed feature (duplicate)

Opened December 04, 2012 03:52PM UTC

Closed December 05, 2012 02:23AM UTC

replaceWith fails to replace all objects

Reported by: scaryclam Owned by: rwaldron
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.2
Keywords: Cc:
Blocked by: Blocking:
Description

I recently came across the following problem. When trying to use replaceWith on a class selector I found that when I pass an object, only the last matched element actually gets replaced. The rest get the appearance of being deleted. However, when using replaceWith with a string as the replacement it functions as I originally expected.

I created the following fiddle to demonstrate the issue: http://jsfiddle.net/xksNb/

I don't think that this is a bug as the documentation states that when getting a DOM object and using it for the replacement, it will not be cloned. However, this seems unintuitive when creating a NEW object as a local variable and then trying to use that to replace elements. It would be nice if the docs made it clearer that this is the designed behaviour or if it was possible to create a new object and have it act like a string replace.

Hope that was all clear!

Becky Lewis

Attachments (0)
Change History (2)

Changed December 05, 2012 02:19AM UTC by rwaldron comment:1

owner: → rwaldron
status: newassigned

Changed December 05, 2012 02:23AM UTC by rwaldron comment:2

resolution: → duplicate
status: assignedclosed

Duplicate of #12449.