If I inspect the current document with javascript using document.styleSheets
, I will get a StyleSheetList
object back which lists all of the document's current stylesheets.
I'd like to do the same for inline stylesheets in a document fetched via XHR. I can get the XHR'ed document. The parsed document has a node interface which I can walk over in javascript and see inline <style>
tags, but xhrDocument.styleSheets is always length 0.
Is there another way of approaching this short of parsing the CSS in javascript? Ideally something that works cross-browser. I also don't want to inject the stylesheet into the current document unless I can do so in some inert manner that won't affect the current document under any circumstances.