Fix critical table shell height alignment
This commit is contained in:
@@ -3,19 +3,29 @@ window.rolemasterTables = window.rolemasterTables || {
|
|||||||
const tables = document.querySelectorAll(".critical-table");
|
const tables = document.querySelectorAll(".critical-table");
|
||||||
|
|
||||||
for (const table of tables) {
|
for (const table of tables) {
|
||||||
for (const cell of table.querySelectorAll("td > .critical-cell")) {
|
for (const shell of table.querySelectorAll("td > .critical-table-cell-shell")) {
|
||||||
cell.style.minHeight = "";
|
shell.style.minHeight = "";
|
||||||
|
|
||||||
|
const criticalCell = shell.querySelector(":scope > .critical-cell");
|
||||||
|
if (criticalCell) {
|
||||||
|
criticalCell.style.minHeight = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const row of table.tBodies) {
|
for (const row of table.tBodies) {
|
||||||
for (const tr of row.rows) {
|
for (const tr of row.rows) {
|
||||||
for (const cell of tr.cells) {
|
for (const cell of tr.cells) {
|
||||||
const criticalCell = cell.querySelector(":scope > .critical-cell");
|
const shell = cell.querySelector(":scope > .critical-table-cell-shell");
|
||||||
if (!criticalCell) {
|
if (!shell) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
criticalCell.style.minHeight = `${cell.clientHeight}px`;
|
const computedStyle = window.getComputedStyle(cell);
|
||||||
|
const paddingTop = Number.parseFloat(computedStyle.paddingTop) || 0;
|
||||||
|
const paddingBottom = Number.parseFloat(computedStyle.paddingBottom) || 0;
|
||||||
|
const contentHeight = Math.max(0, cell.clientHeight - paddingTop - paddingBottom);
|
||||||
|
|
||||||
|
shell.style.minHeight = `${contentHeight}px`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user