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 );
+ }
});
},
}
function buildFragment( args, nodes, scripts ) {
- var fragment, cacheable, cached, cacheresults, doc;
+ var fragment, cacheable, cacheresults, doc;
if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && args[0].indexOf("<option") < 0 ) {
cacheable = true;
if ( cacheresults !== 1 ) {
fragment = cacheresults;
}
- cached = true;
}
}