I'm making a greasemonkey userscript that is supposed to preload certain data (actually, xkcd comic strips) and display them when link is clicked.
My task mostly consists of retrieving data from DOM fetched by ajax and assigning the values to DOM the user is viewing. This is one particular case I find jQuery incredibly helpful. But jQuery operates on window.document.
I load and parse document like this:
xhr.onload = function() {
var doc = document.implementation.createDocument(
'http://www.w3.org/1999/xhtml',
'html',
document.doctype
);
doc.documentElement.innerHTML = this.responseText;
}
And I need to perform jQuery selectors on doc, so that I can retrieve the site data (such as comic title).
Once more, the question: How to perform jQuery selectors on custom document object?
$(doc)not work?