Skip to content

Commit

Permalink
NPM version 1.15.1; Fix <tr> being sorted by innerHTML rather than ou…
Browse files Browse the repository at this point in the history
…terHTML.
  • Loading branch information
LeeWannacott committed May 18, 2023
1 parent 5697bc8 commit ca89689
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 25 deletions.
2 changes: 1 addition & 1 deletion browser-extensions/chrome/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 3,
"author": "Lee Wannacott",
"name": "table-sort-js",
"version": "1.15.0",
"version": "1.15.1",
"description": "Makes tables sortable using table-sort-js: https://github.com/LeeWannacott/table-sort-js",
"icons": { "48": "icons/t.png" },
"browser_action": {
Expand Down
Binary file modified browser-extensions/chrome/table-sort-js.zip
Binary file not shown.
14 changes: 7 additions & 7 deletions browser-extensions/chrome/table-sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
const dataAttributeTd = tr.querySelectorAll("td").item(columnIndex)
.dataset.sort;
columnData.push(`${dataAttributeTd}#${i}`);
columnIndexAndTableRow[columnData[i]] = tr.innerHTML;
columnIndexAndTableRow[columnData[i]] = tr.outerHTML;
}
}

Expand Down Expand Up @@ -206,7 +206,7 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
timeinSeconds = hours + minutesInSeconds + seconds;
}
columnData.push(`${timeinSeconds}#${i}`);
columnIndexAndTableRow[columnData[i]] = tr.innerHTML;
columnIndexAndTableRow[columnData[i]] = tr.outerHTML;
}
} catch (e) {
console.log(e);
Expand Down Expand Up @@ -244,7 +244,7 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
);
}
columnData.push(`${numberToSort}#${i}`);
columnIndexAndTableRow[columnData[i]] = tr.innerHTML;
columnIndexAndTableRow[columnData[i]] = tr.outerHTML;
}
} catch (e) {
console.log(e);
Expand Down Expand Up @@ -302,7 +302,7 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
}
if (tdTextContent.trim() !== "") {
if (isFileSize) {
fileSizeColumnTextAndRow[columnData[i]] = tr.innerHTML;
fileSizeColumnTextAndRow[columnData[i]] = tr.outerHTML;
}
// These classes already handle pushing to column and setting the tr html.
if (
Expand All @@ -314,12 +314,12 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
!isSortDateMonthDayYear
) {
columnData.push(`${tdTextContent}#${i}`);
columnIndexAndTableRow[`${tdTextContent}#${i}`] = tr.innerHTML;
columnIndexAndTableRow[`${tdTextContent}#${i}`] = tr.outerHTML;
}
} else {
// Fill in blank table cells dict key with filler value.
columnData.push(`${fillValue}#${i}`);
columnIndexAndTableRow[`${fillValue}#${i}`] = tr.innerHTML;
columnIndexAndTableRow[`${fillValue}#${i}`] = tr.outerHTML;
}
}

Expand Down Expand Up @@ -423,7 +423,7 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
tr.querySelectorAll("td").item(columnIndex).innerHTML =
fileSizeInBytesHTML;
} else if (!isFileSize) {
tr.innerHTML = columnIndexAndTableRow[columnData[i]];
tr.outerHTML = columnIndexAndTableRow[columnData[i]];
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion browser-extensions/firefox/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"author": "Lee Wannacott",
"name": "table-sort-js",
"version": "1.15.0",
"version": "1.15.1",
"description": "Makes tables sortable using table-sort-js: https://github.com/LeeWannacott/table-sort-js",
"icons": { "48": "icons/t.png" },
"browser_action": {
Expand Down
Binary file modified browser-extensions/firefox/table-sort-js.zip
Binary file not shown.
14 changes: 7 additions & 7 deletions browser-extensions/firefox/table-sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
const dataAttributeTd = tr.querySelectorAll("td").item(columnIndex)
.dataset.sort;
columnData.push(`${dataAttributeTd}#${i}`);
columnIndexAndTableRow[columnData[i]] = tr.innerHTML;
columnIndexAndTableRow[columnData[i]] = tr.outerHTML;
}
}

Expand Down Expand Up @@ -206,7 +206,7 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
timeinSeconds = hours + minutesInSeconds + seconds;
}
columnData.push(`${timeinSeconds}#${i}`);
columnIndexAndTableRow[columnData[i]] = tr.innerHTML;
columnIndexAndTableRow[columnData[i]] = tr.outerHTML;
}
} catch (e) {
console.log(e);
Expand Down Expand Up @@ -244,7 +244,7 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
);
}
columnData.push(`${numberToSort}#${i}`);
columnIndexAndTableRow[columnData[i]] = tr.innerHTML;
columnIndexAndTableRow[columnData[i]] = tr.outerHTML;
}
} catch (e) {
console.log(e);
Expand Down Expand Up @@ -302,7 +302,7 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
}
if (tdTextContent.trim() !== "") {
if (isFileSize) {
fileSizeColumnTextAndRow[columnData[i]] = tr.innerHTML;
fileSizeColumnTextAndRow[columnData[i]] = tr.outerHTML;
}
// These classes already handle pushing to column and setting the tr html.
if (
Expand All @@ -314,12 +314,12 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
!isSortDateMonthDayYear
) {
columnData.push(`${tdTextContent}#${i}`);
columnIndexAndTableRow[`${tdTextContent}#${i}`] = tr.innerHTML;
columnIndexAndTableRow[`${tdTextContent}#${i}`] = tr.outerHTML;
}
} else {
// Fill in blank table cells dict key with filler value.
columnData.push(`${fillValue}#${i}`);
columnIndexAndTableRow[`${fillValue}#${i}`] = tr.innerHTML;
columnIndexAndTableRow[`${fillValue}#${i}`] = tr.outerHTML;
}
}

Expand Down Expand Up @@ -423,7 +423,7 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
tr.querySelectorAll("td").item(columnIndex).innerHTML =
fileSizeInBytesHTML;
} else if (!isFileSize) {
tr.innerHTML = columnIndexAndTableRow[columnData[i]];
tr.outerHTML = columnIndexAndTableRow[columnData[i]];
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion npm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "table-sort-js",
"version": "1.15.0",
"version": "1.15.1",
"description": "A JavaScript client-side HTML table sorting library with no dependencies required.",
"license": "MIT",
"repository": "LeeWannacott/table-sort-js",
Expand Down
14 changes: 7 additions & 7 deletions npm/table-sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
const dataAttributeTd = tr.querySelectorAll("td").item(columnIndex)
.dataset.sort;
columnData.push(`${dataAttributeTd}#${i}`);
columnIndexAndTableRow[columnData[i]] = tr.innerHTML;
columnIndexAndTableRow[columnData[i]] = tr.outerHTML;
}
}

Expand Down Expand Up @@ -206,7 +206,7 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
timeinSeconds = hours + minutesInSeconds + seconds;
}
columnData.push(`${timeinSeconds}#${i}`);
columnIndexAndTableRow[columnData[i]] = tr.innerHTML;
columnIndexAndTableRow[columnData[i]] = tr.outerHTML;
}
} catch (e) {
console.log(e);
Expand Down Expand Up @@ -244,7 +244,7 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
);
}
columnData.push(`${numberToSort}#${i}`);
columnIndexAndTableRow[columnData[i]] = tr.innerHTML;
columnIndexAndTableRow[columnData[i]] = tr.outerHTML;
}
} catch (e) {
console.log(e);
Expand Down Expand Up @@ -302,7 +302,7 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
}
if (tdTextContent.trim() !== "") {
if (isFileSize) {
fileSizeColumnTextAndRow[columnData[i]] = tr.innerHTML;
fileSizeColumnTextAndRow[columnData[i]] = tr.outerHTML;
}
// These classes already handle pushing to column and setting the tr html.
if (
Expand All @@ -314,12 +314,12 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
!isSortDateMonthDayYear
) {
columnData.push(`${tdTextContent}#${i}`);
columnIndexAndTableRow[`${tdTextContent}#${i}`] = tr.innerHTML;
columnIndexAndTableRow[`${tdTextContent}#${i}`] = tr.outerHTML;
}
} else {
// Fill in blank table cells dict key with filler value.
columnData.push(`${fillValue}#${i}`);
columnIndexAndTableRow[`${fillValue}#${i}`] = tr.innerHTML;
columnIndexAndTableRow[`${fillValue}#${i}`] = tr.outerHTML;
}
}

Expand Down Expand Up @@ -423,7 +423,7 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
tr.querySelectorAll("td").item(columnIndex).innerHTML =
fileSizeInBytesHTML;
} else if (!isFileSize) {
tr.innerHTML = columnIndexAndTableRow[columnData[i]];
tr.outerHTML = columnIndexAndTableRow[columnData[i]];
}
}
}
Expand Down
1 change: 0 additions & 1 deletion public/table-sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,6 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
}
}


function updateTable(tableProperties) {
const { tableRows, columnData, isFileSize } = tableProperties;
for (let [i, tr] of tableRows.entries()) {
Expand Down

0 comments on commit ca89689

Please sign in to comment.