From d605322c105f4edc37e9a6357af23c4cee53c2cc Mon Sep 17 00:00:00 2001 From: Richard Gibson <richard.gibson@gmail.com> Date: Mon, 22 Apr 2013 21:08:18 -0400 Subject: Fix #13810: .replaceWith(nextSibling) (cherry picked from commit d8f7e8371230a6dd504ca02e65442745b6ff6ce2) --- src/manipulation.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/manipulation.js') diff --git a/src/manipulation.js b/src/manipulation.js index 8806455eb..0b6a2d7a0 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -207,6 +207,10 @@ jQuery.fn.extend({ parent = args[ i++ ]; if ( parent ) { + // Don't use the snapshot next if it has moved (#13810) + if ( next && next.parentNode !== parent ) { + next = this.nextSibling; + } jQuery( this ).remove(); parent.insertBefore( elem, next ); } -- cgit v1.2.3