JSFiddle - React, Tailwind, and code Playground

HTML

<div id="test"></div>
<div id="output"></div>

CSS

#test {
    background-color: red;
    height: 10px;
    width: 20px;
    opacity: 0.6;
}

JavaScript

var c1 = getComputedStyle(test);
var c2 = getComputedStyle(test.cloneNode(true));
output.innerHTML = (c1.cssText == c2.cssText) + "<br>" +
    "test opacity: \"" + c1.opacity + "\"<br>" +
    "clone opacity: \"" + c2.opacity + "\"";

var c3 = document.createElement('div');
c3.setAttribute('id', 'test');
c3 = getComputedStyle(c3);
output.innerHTML += "<br>new opacity: \"" + c3.opacity + "\"";