mirror of
https://github.com/jquery/jquery.git
synced 2026-02-13 23:05:50 -05:00
Make sure that wrapInner works on elements that have no contents. Fixes #3552.
This commit is contained in:
@@ -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 );
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user