Skip to content

Commit

Permalink
Version 1.19.0; support for tables with no <th> tag.
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeWannacott committed Mar 15, 2024
1 parent bc7d1e0 commit cadb78f
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 6 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.18.3",
"version": "1.19.0",
"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.
6 changes: 5 additions & 1 deletion browser-extensions/chrome/table-sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
headers: [],
};
for (let index of table.theads.keys()) {
table.headers.push(table.theads.item(index).querySelectorAll("th"));
if (table.theads.item(index).querySelectorAll("th").length == 0) {
table.headers.push(table.theads.item(index).querySelectorAll("td"));
} else {
table.headers.push(table.theads.item(index).querySelectorAll("th"));
}
}
for (let index of table.bodies.keys()) {
if (table.bodies.item(index) == null) {
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.18.3",
"version": "1.19.0",
"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.
6 changes: 5 additions & 1 deletion browser-extensions/firefox/table-sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
headers: [],
};
for (let index of table.theads.keys()) {
table.headers.push(table.theads.item(index).querySelectorAll("th"));
if (table.theads.item(index).querySelectorAll("th").length == 0) {
table.headers.push(table.theads.item(index).querySelectorAll("td"));
} else {
table.headers.push(table.theads.item(index).querySelectorAll("th"));
}
}
for (let index of table.bodies.keys()) {
if (table.bodies.item(index) == null) {
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.18.3",
"version": "1.19.0",
"description": "A JavaScript client-side HTML table sorting library with no dependencies required.",
"license": "MIT",
"repository": "LeeWannacott/table-sort-js",
Expand Down
6 changes: 5 additions & 1 deletion npm/table-sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
headers: [],
};
for (let index of table.theads.keys()) {
table.headers.push(table.theads.item(index).querySelectorAll("th"));
if (table.theads.item(index).querySelectorAll("th").length == 0) {
table.headers.push(table.theads.item(index).querySelectorAll("td"));
} else {
table.headers.push(table.theads.item(index).querySelectorAll("th"));
}
}
for (let index of table.bodies.keys()) {
if (table.bodies.item(index) == null) {
Expand Down

0 comments on commit cadb78f

Please sign in to comment.