const tableId = 'news';
const trSelector = 'tbody tr';
Вот jquery:
$(`#${tableId}`).show().not(`:has(${trSelector})`).hide();
// или
const $table = $('[id="' + tableId + '"]');
$table.toggle(!!$table.find(trSelector).length);
А вот jquery нет:
(t => t.hidden = !t.querySelector(trSelector))
(document.querySelector('#'.concat(tableId)));
// или (в стили надо будет добавить .hidden { display: none; })
const table = document.getElementById(tableId);
table.classList.toggle('hidden', Array.prototype.every.call(
table.tBodies,
n => !n.rows.length
));
UPD.
Наконец-то дождались, теперь js тут не нужен:
#news:not(:has(tbody tr)) {
display: none;
}