JSFiddle - React, Tailwind, and code Playground
JavaScript
var html = '<html><style>div { color: blue; }</style></html>';
/* Simple document parsing */
var doc = document.implementation.createHTMLDocument("");
doc.documentElement.innerHTML = html;
// Here we change the contents of the style element
doc.querySelector('style').innerText = 'span { background: green; }';
// In all browsers the sheet property should still have a value
console.log('createHTMLDocument', doc.querySelector('style').sheet);
/* Document parsing via iframe */
var iframe = document.querySelector('iframe'),
iframeDoc = iframe.contentDocument;
iframeDoc.open();
iframeDoc.write("<!DOCTYPE html>");
iframeDoc.write(html);
iframeDoc.close();
// Here we clean up the iframe, which seem to trigger the issue. Manipulating style elements from now on seems to lose the sheet property.
iframe.parentElement.removeChild(iframe);
// Here we change the contents of the style element
iframeDoc.querySelector('style').innerText = 'span { background: green; }';
// In newer Chromes the sheet property is lost
console.log('iframe', iframeDoc.querySelector('style').sheet);