Last active
November 10, 2016 13:04
-
-
Save netsi1964/91f4d484efe513505d28bbfdf20eaa64 to your computer and use it in GitHub Desktop.
Function to get cleaned HTML from generated React HTML (for Chrome console)
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 cleanReactHTML(html) { | |
var result = html.replace(/data-reactid="[\.\d:\D]{1,23}"/g,''); | |
result = result.replace(/data-reactroot="[\.\d:\D]{1,23}"/g,''); | |
result = result.replace(/<!--[\s\S]*?-->/g,''); | |
return result | |
} | |
copy(cleanReactHTML(document.querySelector('.app').innerHTML)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment