aboutsummaryrefslogtreecommitdiffstats
path: root/src/manipulation.js
diff options
context:
space:
mode:
authorjeresig <jeresig@gmail.com>2010-01-11 16:31:31 -0500
committerjeresig <jeresig@gmail.com>2010-01-11 16:31:31 -0500
commit23d600c66d8e1f7298dcb46eedba862279cd251d (patch)
treebcb2ef8516d0712e08776f29bd4d77b576dda3f5 /src/manipulation.js
parent3e9ef6f5c08e63a90ef2dfd3bdc833994e7a0ac8 (diff)
downloadjquery-23d600c66d8e1f7298dcb46eedba862279cd251d.tar.gz
jquery-23d600c66d8e1f7298dcb46eedba862279cd251d.zip
Make sure that wrapInner works on elements that have no contents. Fixes #3552.
Diffstat (limited to 'src/manipulation.js')
-rw-r--r--src/manipulation.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/manipulation.js b/src/manipulation.js
index 3db2c3552..742ec2543 100644
--- a/src/manipulation.js
+++ b/src/manipulation.js
@@ -77,7 +77,14 @@ jQuery.fn.extend({
wrapInner: function( html ) {
return this.each(function() {
- jQuery( this ).contents().wrapAll( html );
+ var self = jQuery( this ), contents = self.contents();
+
+ if ( contents.length ) {
+ contents.wrapAll( html );
+
+ } else {
+ self.append( html );
+ }
});
},