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>
<svg id="target">
</svg>
CSS
#report {
color: black;
background-color: white;
}
JavaScript
const properties = ['align-content', 'align-items', 'align-self', 'justify-content', 'justify-items', 'justify-self'];
for (let property of properties) {
test(property, "end safe");
test(property, "safe end");
}
function test(property, values) {
const target = document.getElementById("target");
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] = '';
}
}