I have a JS variable that contains an a string that represents an HTML page. For example:
var response = "<!DOCTYPE html><html><body><h1>This is heading 1</h1></body></html>"
I'd like to perform query selectors and xpath evaluations on this response to traverse through the HTML elements. Since the response is not in the DOM I can't use document.x
actions.
One option is to write it into an invisible iframe in the DOM but this is not allowed for Chrome extensions. Are there any other alternatives?