The following code snippet will create new document object with the HTML code. By referencing the following statement, I should get the array of attached stylesheets, but I'm getting ZERO results.
doc.styleSheets
But the similar statement works fine for the current document like
document.styleSheets.
Help me to find what's I'm doing wrong.
var doc = document.implementation.createHTMLDocument(title);
doc.documentElement.innerHTML = '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Title</title>
<link rel="stylesheet" href="http://localhost/style.css" type="text/css" />
</head>
<body>
Hello world!
</body>
</html>';
var sheets = doc.styleSheets; // it gives ZERO results