From 7b09235ceed57bbcc26fc2c76147eb4e95ebdb92 Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Sun, 11 Jan 2015 22:17:41 -0500 Subject: Wrap: Support .unwrap( selector) for selective unwrapping Fixes gh-1744 Closes gh-2003 --- src/wrap.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/wrap.js b/src/wrap.js index ee02aca75..0d9bf0f2e 100644 --- a/src/wrap.js +++ b/src/wrap.js @@ -63,12 +63,11 @@ jQuery.fn.extend({ }); }, - unwrap: function() { - return this.parent().each(function() { - if ( !jQuery.nodeName( this, "body" ) ) { - jQuery( this ).replaceWith( this.childNodes ); - } - }).end(); + unwrap: function( selector ) { + this.parent( selector ).not( "body" ).each(function() { + jQuery( this ).replaceWith( this.childNodes ); + }); + return this; } }); -- cgit v1.2.3