I though this might help someone. To get the html content of a selection you can do this:
jQuery("<div></ div>").append(window.getSelection().getRangeAt(0).cloneContents().childNodes).html(); It only working in firefox, but I'm sure it could be made to work in IE too.