Bug Tracker

Modify

Ticket #5986 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

regression: replaceWith treats text only node as selector

Reported by: iamnoah Owned by: john
Priority: major Milestone: 1.4.2
Component: manipulation Version: 1.4.1
Keywords: Cc:
Blocking: Blocked by:

Description

Given the HTML:

123<div id="foo">Foo</div>456

The code

$('#foo').replaceWith('Bar');

Previously (in 1.3.2) would result in: 123Bar456

Now you get: 123456

The problem is that $(value).detach() is being used internally, which treats the string 'Bar' as a selector instead of a text node. Since it doesn't find anything, the node is just removed.

Change History

comment:1 Changed 3 years ago by john

  • Owner set to john
  • Status changed from new to assigned

Good catch, I'll look in to this.

comment:3 Changed 3 years ago by john

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

comment:4 Changed 3 years ago by john

  • Component changed from core to manipulation

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.