Modify ↓
Ticket #5986 (closed bug: fixed)
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
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

Good catch, I'll look in to this.