After a row is deleted from a table, its width may change. However, the table's width transition does not fire, probably because the width css property was never changed directly, only its calculated value.
How do I make a table smoothly animate its width after a row is deleted, even if its css style width has not changed?
Example:
<style>
table {
transition: all 500ms ease-in-out;
}
</style>
<script>
function test(button) {
var el=document.getElementById("to-delete");
el.parentNode.removeChild(el);
button.parentNode.removeChild(button);
}
</script>
<table>
<tr><td>id</td><td>type</td></tr>
<tr id="to-delete"><td>165495</td><td>user</td></tr>
<tr><td>12</td><td>user</td></tr>
</table>
<button onclick="test(this)">Test</test>
The same moment the row is deleted, the table width abruptly changes its width to the final value, despite the css transition:
table {
transition: all 500ms ease-in-out;
}
Is there any way to make the table obey the rule in this case?