jQuery.clean takes array-like collections, so this should work as well:
jQuery.fn.wrapInner = function(html){
return this.each(function(){
jQuery(html).append(this.childNodes).appendTo(this);
});
};
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of John Resig
Sent: Monday, February 19, 2007 10:50 AM
To: jQuery Discussion.
Subject: Re: [jQuery] wrapinner with 1.1.1
It seems like this would be a better solution:
jQuery.fn.wrapInner = function(html){
return this.each(function(){
var wrap = $(html);
while ( this.firstChild )
wrap.append( this.firstChild );
wrap.appendTo( this );
});
};
no need for a filter, and you don't lose your events. You can use it like
this:
$("p").wrapInner("<a href=''></a>");
--John
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/