Skip to content

Commit 77a7b8f

Browse files
committed
code review: fix quirks introduced with 2256552
1 parent 7c63d2b commit 77a7b8f

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

src/js/logger-ui.js

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,10 @@ var createRow = function(layout) {
238238
if ( !td ) { break; }
239239
tdJunkyard.push(tr.removeChild(td));
240240
}
241+
tr.removeAttribute('data-tabid');
241242
tr.removeAttribute('data-srchn');
242243
tr.removeAttribute('data-deshn');
244+
tr.removeAttribute('data-type');
243245
return tr;
244246
};
245247

@@ -256,7 +258,7 @@ var createGap = function(tabId, url) {
256258
tr.classList.add('doc');
257259
tr.classList.add('tab');
258260
tr.classList.add('canMtx');
259-
tr.classList.add('tab_' + tabId);
261+
tr.setAttribute('data-tabid', tabId);
260262
tr.cells[firstVarDataCol].textContent = url;
261263
tbody.insertBefore(tr, tbody.firstChild);
262264
};
@@ -398,15 +400,13 @@ var renderLogEntries = function(response) {
398400
/******************************************************************************/
399401

400402
var synchronizeTabIds = function(newPageStores) {
401-
var oldPageStores = pageStores;
402-
var autoDeleteVoidRows = !!vAPI.localStorage.getItem('loggerAutoDeleteVoidRows');
403-
var rowVoided = false;
404-
var trs;
405-
for ( let entry of oldPageStores ) {
406-
let tabId = entry[0];
403+
let oldPageStores = pageStores;
404+
let autoDeleteVoidRows = !!vAPI.localStorage.getItem('loggerAutoDeleteVoidRows');
405+
let rowVoided = false;
406+
for ( let tabId of oldPageStores.keys() ) {
407407
if ( newPageStores.has(tabId) ) { continue; }
408408
// Mark or remove voided rows
409-
trs = uDom('.tab_' + tabId);
409+
let trs = uDom('[data-tabid="' + tabId + '"]');
410410
if ( autoDeleteVoidRows ) {
411411
toJunkyard(trs);
412412
} else {
@@ -415,16 +415,15 @@ var synchronizeTabIds = function(newPageStores) {
415415
}
416416
}
417417

418-
var select = document.getElementById('pageSelector');
419-
var selectValue = select.value;
420-
var tabIds = Array.from(newPageStores.keys()).sort(function(a, b) {
418+
let select = document.getElementById('pageSelector');
419+
let selectValue = select.value;
420+
let tabIds = Array.from(newPageStores.keys()).sort(function(a, b) {
421421
return newPageStores.get(a).localeCompare(newPageStores.get(b));
422422
});
423-
var option;
424423
for ( var i = 0, j = 2; i < tabIds.length; i++ ) {
425424
let tabId = tabIds[i];
426425
if ( tabId === noTabId ) { continue; }
427-
option = select.options[j];
426+
let option = select.options[j];
428427
j += 1;
429428
if ( !option ) {
430429
option = document.createElement('option');
@@ -1085,7 +1084,7 @@ uDom('#clean').on('click', cleanBuffer);
10851084
uDom('#clear').on('click', clearBuffer);
10861085
uDom('#maxEntries').on('change', onMaxEntriesChanged);
10871086
uDom('#content table').on('click', 'tr > td:nth-of-type(1)', toggleCompactRow);
1088-
uDom('#content table').on('click', 'tr.canMtx > td:nth-of-type(3)', ruleEditor.start);
1087+
uDom('#content table').on('click', 'tr[data-srchn][data-deshn][data-type] > td:nth-of-type(3)', ruleEditor.start);
10891088

10901089
/******************************************************************************/
10911090

0 commit comments

Comments
 (0)