aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDave Methvin <dave.methvin@gmail.com>2015-01-11 22:17:41 -0500
committerDave Methvin <dave.methvin@gmail.com>2015-03-30 13:38:40 -0400
commit7b09235ceed57bbcc26fc2c76147eb4e95ebdb92 (patch)
tree5051caa368061658f1ceb718136b0dee22adbe18 /src
parent06f6cd1ffd2a4e9f5955d146d229492f245d83cb (diff)
downloadjquery-7b09235ceed57bbcc26fc2c76147eb4e95ebdb92.tar.gz
jquery-7b09235ceed57bbcc26fc2c76147eb4e95ebdb92.zip
Wrap: Support .unwrap( selector) for selective unwrapping
Fixes gh-1744 Closes gh-2003
Diffstat (limited to 'src')
-rw-r--r--src/wrap.js11
1 files changed, 5 insertions, 6 deletions
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;
}
});