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;
}

#container {
  transform-style: preserve-3d;
  width: 100px;
  height: 100px;
  font-size: 20px;
  column-gap: 20px;
  column-width: 20px;
}

#target {
  image-rendering: -webkit-optimize-contrast;
}

JavaScript

// https://drafts.csswg.org/css-images/#the-image-rendering
// auto | smooth | high-quality | crisp-edges | pixelated
test("image-rendering", "auto");
test("image-rendering", "smooth");
test("image-rendering", "high-quality");
test("image-rendering", "crisp-edges");
test("image-rendering", "pixelated");

// https://www.w3.org/TR/SVG11/painting.html#ImageRenderingProperty
test("image-rendering", "auto");
test("image-rendering", "optimizespeed");
test("image-rendering", "optimizequality");

// Blink's css_properties.json5
test("image-rendering", "auto");
test("image-rendering", "optimizeSpeed");
test("image-rendering", "optimizeQuality");
test("image-rendering", "-webkit-optimize-contrast");
test("image-rendering", "pixelated");


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] = '';
}

}