Last active
October 26, 2016 14:34
-
-
Save mrowa44/c56b027b2f290fa66a24 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
| getHTML() { | |
| let selector = this.props.selector; | |
| let xhr = new XMLHttpRequest(); | |
| xhr.open('GET', this.props.from, true); | |
| xhr.onreadystatechange = function() { | |
| if (this.readyState === 4) { | |
| let parser = new DOMParser(); | |
| let document = parser.parseFromString(xhr.responseText, 'text/html'); | |
| return document.querySelector(selector); | |
| } | |
| }; | |
| xhr.send(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.