compat(css): fix table layout regression issue, closes #3551 (#3556)

This commit is contained in:
Huang Xin
2026-03-18 00:52:07 +08:00
committed by GitHub
parent 1f7483b911
commit 8280585e70
+3 -11
View File
@@ -190,9 +190,11 @@ const getColorStyles = (
}
table {
overflow: auto;
table-layout: fixed;
display: table !important;
}
table:has(> colgroup) {
table-layout: fixed;
}
/* code */
body.theme-dark code {
${isDarkMode ? `color: ${fg}cc;` : ''}
@@ -910,16 +912,6 @@ export const applyTableStyle = (document: Document) => {
}
}
const computedTableStyle = window.getComputedStyle(table);
const computedWidth = computedTableStyle.width;
if (computedWidth && computedWidth !== 'auto' && computedWidth !== '0px') {
const widthValue = parseFloat(computedWidth);
const widthUnit = computedWidth.replace(widthValue.toString(), '').trim();
if (widthUnit !== '%') {
// Workaround for hardcoded table layout, closes #3205
table.style.width = `calc(min(${computedWidth}, var(--available-width)))`;
}
}
const parentWidth = window.getComputedStyle(parent as Element).width;
const parentContainerWidth = parseFloat(parentWidth) || 0;
if (totalTableWidth > 0) {