Created
December 20, 2019 16:32
-
-
Save Legends/91e880f13e3a13225c96ee24a620f7f4 to your computer and use it in GitHub Desktop.
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
| var doc = document, win = window; | |
| var frag; | |
| function parseHTML(str) { | |
| if (!frag) { | |
| frag = doc.implementation.createHTMLDocument(null); | |
| var base = frag.createElement("base"); | |
| base.href = doc.location.href; | |
| frag.head.appendChild(base); | |
| } | |
| frag.body.innerHTML = str; | |
| return frag.body.childNodes; | |
| } | |
| // usage: | |
| parseHTML("<p class='wixen'><span>hallo</span></p>"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment