replaceWith fails to replace all objects
|Reported by:||scaryclam||Owned by:||rwaldron|
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!