Opened 10 years ago
Closed 10 years ago
#13001 closed feature (duplicate)
replaceWith fails to replace all objects
Reported by: | scaryclam | Owned by: | Rick Waldron |
---|---|---|---|
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
Change History (2)
comment:1 Changed 10 years ago by
Owner: | set to Rick Waldron |
---|---|
Status: | new → assigned |
comment:2 Changed 10 years ago by
Resolution: | → duplicate |
---|---|
Status: | assigned → closed |
Duplicate of #12449.