Side navigation
Ticket #3552: wrapInner.diff
File wrapInner.diff, 0.6 KB (added by ricardobeat, March 05, 2009 12:48AM UTC)
alternative patch (core.js r6270)
Index: jquery/src/core.js
===================================================================
--- jquery/src/core.js (revision 6270)
+++ jquery/src/core.js (working copy)
@@ -250,10 +250,12 @@
return this;
},
- wrapInner: function( html ) {
- return this.each(function(){
- jQuery( this ).contents().wrapAll( html );
- });
+ wrapInner: function( html ) {
+ return this.each(function(){
+ this.firstChild
+ ? jQuery( this ).contents().wrapAll( html )
+ : jQuery( this ).append(html);
+ });
},
wrap: function( html ) {
Download in other formats:
Original Format
File wrapInner.diff, 0.6 KB (added by ricardobeat, March 05, 2009 12:48AM UTC)
alternative patch (core.js r6270)
Index: jquery/src/core.js
===================================================================
--- jquery/src/core.js (revision 6270)
+++ jquery/src/core.js (working copy)
@@ -250,10 +250,12 @@
return this;
},
- wrapInner: function( html ) {
- return this.each(function(){
- jQuery( this ).contents().wrapAll( html );
- });
+ wrapInner: function( html ) {
+ return this.each(function(){
+ this.firstChild
+ ? jQuery( this ).contents().wrapAll( html )
+ : jQuery( this ).append(html);
+ });
},
wrap: function( html ) {