Skip to content

Instantly share code, notes, and snippets.

@gasolin
Created November 12, 2014 03:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gasolin/37663c09509d7774e409 to your computer and use it in GitHub Desktop.
Save gasolin/37663c09509d7774e409 to your computer and use it in GitHub Desktop.
document.getHTML = function(who){
var txt, ax, el= document.createElement("div");
el.appendChild(who.cloneNode(false));
txt= el.innerHTML;
ax= txt.indexOf('>')+1;
txt= txt.substring(0, ax)+who.innerHTML+ txt.substring(ax);
el= null;
return txt.replace(/>/g,'>\n');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment