Wrap: Support .unwrap( selector) for selective unwrapping

Fixes gh-1744
Closes gh-2003
(cherry picked from commit 7b09235cee)
This commit is contained in:
Dave Methvin
2015-01-11 22:17:41 -05:00
parent f9f4f9d32b
commit e38138af6a
2 changed files with 30 additions and 6 deletions

View File

@@ -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;
}
});