diff options
author | jeresig <jeresig@gmail.com> | 2010-01-11 16:31:31 -0500 |
---|---|---|
committer | jeresig <jeresig@gmail.com> | 2010-01-11 16:31:31 -0500 |
commit | 23d600c66d8e1f7298dcb46eedba862279cd251d (patch) | |
tree | bcb2ef8516d0712e08776f29bd4d77b576dda3f5 /src/manipulation.js | |
parent | 3e9ef6f5c08e63a90ef2dfd3bdc833994e7a0ac8 (diff) | |
download | jquery-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.js | 9 |
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 ); + } }); }, |