The context of the callback function is not right when you use replaceWith(function);
$("h3").replaceWith(function(i) { console.log(this); return "<h4>"+$(this).html()+"</h4>"; //broke because the next element of my h3 was coming up as a textnode. //however, any element other than the current is pretty much useless }); replaceWith ends up doing jQuery(next) or jQuery(parent), so the context of the callback ends up being the next element or the parent element. Since the current element isn't passed in as an argument or set as the context, there's presently no way to work with it in the calback. This seems like bug territory. Wish I'd found this earlier...
-- You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-...@googlegroups.com. To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.