Created
February 13, 2013 07:09
-
-
Save rainyjune/4942816 to your computer and use it in GitHub Desktop.
Get outerHTML
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function outerHTML(node) { | |
if(node.outerHTML) return node.outerHTML; | |
var container = document.createElement("div"); | |
container.appendChild(node.cloneNode(true)); | |
return container.innerHTML; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment