Bug Tracker

Opened 9 years ago

Closed 8 years ago

#12449 closed bug (fixed)

replaceWith() doesn't clone elements where required

Reported by: rod@… Owned by: rod@…
Priority: high Milestone: 1.9
Component: manipulation Version: 1.8.0
Keywords: Cc:
Blocked by: Blocking:


(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 9 years ago by timmywil

Component: unfiledmanipulation
Priority: undecidedhigh
Status: newopen

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

comment:2 Changed 9 years ago by timmywil

Owner: set to rod@…
Status: openpending

comment:3 Changed 9 years ago by rod@…

Status: pendingnew

@timmywil: this should do it: http://jsfiddle.net/fHhKf/4/

comment:4 Changed 9 years ago by mikesherov

Status: newassigned

comment:5 Changed 9 years ago by dmethvin

Milestone: None1.9

See additional discussion in https://github.com/jquery/jquery/pull/920

comment:6 Changed 8 years ago by Rick Waldron

#13001 is a duplicate of this ticket.

comment:7 Changed 8 years ago by Rod Vagg

Resolution: fixed
Status: assignedclosed

Fixes #12449. make replaceWith() clone elements where required. Closes gh-920

Changeset: 551c2c9f4ac776b6d53600c452ad40a4b4d6670b

Note: See TracTickets for help on using tickets.