JSFiddle - React, Tailwind, and code Playground

JavaScript

var srcdoc = `<root>
  <style xmlns="http://www.w3.org/1999/xhtml">
    :root { color: red }
  </style>
  <div xmlns="http://www.w3.org/1999/xhtml" style="background:yellow">#</div>
</root>`;

var xmldoc = (xhr => (
  xhr.open("GET", "data:text/xml,"+escape(srcdoc), false), 
  xhr.send(null), 
  xhr.responseXML
))(new XMLHttpRequest());

alert(getComputedStyle(xmldoc.documentElement).color); // red
alert(getComputedStyle(xmldoc.documentElement.lastElementChild).display); // block
alert(getComputedStyle(xmldoc.documentElement.lastElementChild).backgroundColor); // yellow

xmldoc.documentElement.lastElementChild.style.background = 'lime';
alert(getComputedStyle(xmldoc.documentElement.lastElementChild).backgroundColor); // lime