JSFiddle - React, Tailwind, and code Playground

by ericwilligers

HTML

<table id="report">
  <tr>
    <th>Property</th>
    <th>Assigned</th>
    <th>Serialized</th>
    <th>Computed</th>
  </tr>
</table>
<div id="container">
  <div id="target">
    <div id="child"></div>  
  </div>
</div>

CSS

#report {
  color: black;
  background-color: white;
}

JavaScript

const values = ['-2', '2', '50%'];
const colorValues = values.map(alpha => 'rgba(7, 8, 9, ' + alpha + ')');

test('fill-opacity', values);
test('flood-opacity', values);
test('opacity', values);
test('stop-opacity', values);
test('stroke-opacity', values);
test('shape-image-threshold', values);
test('color', colorValues);
test('stroke-dashoffset', values);

function test(property, values) {

if (!Array.isArray(values)) {
  values = [ values ];
}

for (let value of values) {
  const row = document.createElement('tr');
  const log = (content) => {
    // console.log(content);
    const cell = document.createElement('td');
    cell.textContent = "'" + content + "'";
    row.appendChild(cell);
  }
  
  target.style[property] = '';
  target.style[property] = value;
  log(property);
  log(value);
  log(target.style[property]);
  log(getComputedStyle(target)[property]);


  if (target.style[property] === '')
  	row.style['font-weight'] = 'bold';

  report.appendChild(row);
  target.style[property] = '';
}

}