Skip to content

Commit cadb78f

Browse files
Version 1.19.0; support for tables with no <th> tag.
1 parent bc7d1e0 commit cadb78f

File tree

8 files changed

+18
-6
lines changed

8 files changed

+18
-6
lines changed

browser-extensions/chrome/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"manifest_version": 3,
33
"author": "Lee Wannacott",
44
"name": "table-sort-js",
5-
"version": "1.18.3",
5+
"version": "1.19.0",
66
"description": "Makes tables sortable using table-sort-js: https://github.com/LeeWannacott/table-sort-js",
77
"icons": { "48": "icons/t.png" },
88
"browser_action": {
16 Bytes
Binary file not shown.

browser-extensions/chrome/table-sort.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,11 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
125125
headers: [],
126126
};
127127
for (let index of table.theads.keys()) {
128-
table.headers.push(table.theads.item(index).querySelectorAll("th"));
128+
if (table.theads.item(index).querySelectorAll("th").length == 0) {
129+
table.headers.push(table.theads.item(index).querySelectorAll("td"));
130+
} else {
131+
table.headers.push(table.theads.item(index).querySelectorAll("th"));
132+
}
129133
}
130134
for (let index of table.bodies.keys()) {
131135
if (table.bodies.item(index) == null) {

browser-extensions/firefox/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"manifest_version": 2,
33
"author": "Lee Wannacott",
44
"name": "table-sort-js",
5-
"version": "1.18.3",
5+
"version": "1.19.0",
66
"description": "Makes tables sortable using table-sort-js: https://github.com/LeeWannacott/table-sort-js",
77
"icons": { "48": "icons/t.png" },
88
"browser_action": {
16 Bytes
Binary file not shown.

browser-extensions/firefox/table-sort.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,11 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
125125
headers: [],
126126
};
127127
for (let index of table.theads.keys()) {
128-
table.headers.push(table.theads.item(index).querySelectorAll("th"));
128+
if (table.theads.item(index).querySelectorAll("th").length == 0) {
129+
table.headers.push(table.theads.item(index).querySelectorAll("td"));
130+
} else {
131+
table.headers.push(table.theads.item(index).querySelectorAll("th"));
132+
}
129133
}
130134
for (let index of table.bodies.keys()) {
131135
if (table.bodies.item(index) == null) {

npm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "table-sort-js",
3-
"version": "1.18.3",
3+
"version": "1.19.0",
44
"description": "A JavaScript client-side HTML table sorting library with no dependencies required.",
55
"license": "MIT",
66
"repository": "LeeWannacott/table-sort-js",

npm/table-sort.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,11 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
125125
headers: [],
126126
};
127127
for (let index of table.theads.keys()) {
128-
table.headers.push(table.theads.item(index).querySelectorAll("th"));
128+
if (table.theads.item(index).querySelectorAll("th").length == 0) {
129+
table.headers.push(table.theads.item(index).querySelectorAll("td"));
130+
} else {
131+
table.headers.push(table.theads.item(index).querySelectorAll("th"));
132+
}
129133
}
130134
for (let index of table.bodies.keys()) {
131135
if (table.bodies.item(index) == null) {

0 commit comments

Comments
 (0)