Bug Tracker

Opened 4 years ago

Closed 4 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:

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

  • Component changed from unfiled to manipulation
  • Priority changed from undecided to high
  • Status changed from new to open

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

  • Owner set to rod@…
  • Status changed from open to pending

comment:3 Changed 4 years ago by rod@…

  • Status changed from pending to new

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

comment:4 Changed 4 years ago by mikesherov

  • Status changed from new to assigned

comment:5 Changed 4 years ago by dmethvin

  • Milestone changed from None to 1.9

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

comment:6 Changed 4 years ago by rwaldron

#13001 is a duplicate of this ticket.

comment:7 Changed 4 years ago by Rod Vagg

  • Resolution set to fixed
  • Status changed from assigned to closed

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

Changeset: 551c2c9f4ac776b6d53600c452ad40a4b4d6670b

Note: See TracTickets for help on using tickets.