treewide: transition div tables to actual table markup
[project/luci.git] / modules / luci-base / htdocs / luci-static / resources / cbi.js
index 92c41515fb3d166a75600b9043ef4f325c1301c9..b66fe684a5d16eea48403ee006d6473054f55754 100644 (file)
@@ -744,22 +744,22 @@ function cbi_update_table(table, data, placeholder) {
        if (!isElem(target))
                return;
 
-       target.querySelectorAll('.tr.table-titles, .cbi-section-table-titles').forEach(function(thead) {
+       target.querySelectorAll('tr.table-titles, .tr.table-titles, .cbi-section-table-titles').forEach(function(thead) {
                var titles = [];
 
-               thead.querySelectorAll('.th').forEach(function(th) {
+               thead.querySelectorAll('th, .th').forEach(function(th) {
                        titles.push(th);
                });
 
                if (Array.isArray(data)) {
-                       var n = 0, rows = target.querySelectorAll('.tr');
+                       var n = 0, rows = target.querySelectorAll('tr, .tr');
 
                        data.forEach(function(row) {
-                               var trow = E('div', { 'class': 'tr' });
+                               var trow = E('tr', { 'class': 'tr' });
 
                                for (var i = 0; i < titles.length; i++) {
                                        var text = (titles[i].innerText || '').trim();
-                                       var td = trow.appendChild(E('div', {
+                                       var td = trow.appendChild(E('td', {
                                                'class': titles[i].className,
                                                'data-title': (text !== '') ? text : null
                                        }, row[i] || ''));
@@ -780,8 +780,8 @@ function cbi_update_table(table, data, placeholder) {
                                target.removeChild(rows[n]);
 
                        if (placeholder && target.firstElementChild === target.lastElementChild) {
-                               var trow = target.appendChild(E('div', { 'class': 'tr placeholder' }));
-                               var td = trow.appendChild(E('div', { 'class': titles[0].className }, placeholder));
+                               var trow = target.appendChild(E('tr', { 'class': 'tr placeholder' }));
+                               var td = trow.appendChild(E('td', { 'class': titles[0].className }, placeholder));
 
                                td.classList.remove('th');
                                td.classList.add('td');
@@ -790,10 +790,10 @@ function cbi_update_table(table, data, placeholder) {
                else {
                        thead.parentNode.style.display = 'none';
 
-                       thead.parentNode.querySelectorAll('.tr, .cbi-section-table-row').forEach(function(trow) {
+                       thead.parentNode.querySelectorAll('tr, .tr, .cbi-section-table-row').forEach(function(trow) {
                                if (trow !== thead) {
                                        var n = 0;
-                                       trow.querySelectorAll('.th, .td').forEach(function(td) {
+                                       trow.querySelectorAll('th, td, .th, .td').forEach(function(td) {
                                                if (n < titles.length) {
                                                        var text = (titles[n++].innerText || '').trim();
                                                        if (text !== '')