jquery/jquery — pull request #576 by tobio (2011-11-04 09:30:47+00:00)
Title: If function is provided to wrap, call prior to handing off to wrapAll to 

Functions provided to .wrap are handed off to .wrapAll. In these cases .wrapAll is only operating on a single element and hence the index provided to the function is always 0.

I'm calling the function within the .wrap method providing the correct index, and then handing the resultant html to .wrapAll