Opened 10 years ago
Closed 10 years ago
#12449 closed bug (fixed)
replaceWith() doesn't clone elements where required
| Reported by: | Owned by: | ||
|---|---|---|---|
| Priority: | high | Milestone: | 1.9 |
| Component: | manipulation | Version: | 1.8.0 |
| Keywords: | Cc: | ||
| Blocked by: | Blocking: |
Description
(from https://github.com/jquery/jquery/pull/920)
I thought I'd try jQuery over the new comprehensive test suite we have for the various insertion methods in Bonzo and discovered that jQuery's replaceWith() wasn't properly cloning where required.
Inside replaceWith() this.each() is used which then passes a singular collection for each element in this to before() or append() which then invokes domManip(), the clone check inside domManip() (see iNoClone = results.cacheable || l - 1 -- l always == 1).
Change History (7)
comment:1 Changed 10 years ago by
| Component: | unfiled → manipulation |
|---|---|
| Priority: | undecided → high |
| Status: | new → open |
comment:2 Changed 10 years ago by
| Owner: | set to [email protected]… |
|---|---|
| Status: | open → pending |
comment:3 Changed 10 years ago by
| Status: | pending → new |
|---|
@timmywil: this should do it: http://jsfiddle.net/fHhKf/4/
comment:4 Changed 10 years ago by
| Status: | new → assigned |
|---|
comment:5 Changed 10 years ago by
| Milestone: | None → 1.9 |
|---|
See additional discussion in https://github.com/jquery/jquery/pull/920
comment:7 Changed 10 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Fixes #12449. make replaceWith() clone elements where required. Closes gh-920
Changeset: 551c2c9f4ac776b6d53600c452ad40a4b4d6670b

Thanks for writing tests in the pull! Just for clarity's sake, do you have a fiddle somewhere that also demonstrates the problem?