Make sure that wrapInner works on elements that have no contents. Fixes #3552.
This commit is contained in:
parent
3e9ef6f5c0
commit
23d600c66d
2 changed files with 14 additions and 2 deletions
|
@ -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 );
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue