- wrap: function() {
- // The elements to wrap the target around
- var a, args = arguments;
-
- // Wrap each of the matched elements individually
- return this.each(function(){
- if ( !a )
- a = jQuery.clean(args, this.ownerDocument);
-
- // Clone the structure that we're using to wrap
- var b = a[0].cloneNode(true);
+ wrapAll: function(html) {
+ if ( this[0] )
+ // The elements to wrap the target around
+ jQuery(html, this[0].ownerDocument)
+ .clone()
+ .insertBefore(this[0])
+ .map(function(){
+ var elem = this;
+ while ( elem.firstChild )
+ elem = elem.firstChild;
+ return elem;
+ })
+ .append(this);