Revert "Decide if element is bold by getComputedStyle (#2453) (#2579)"

This reverts commit 9ced6be03e.

Caused a regression:
https://forums.ankiweb.net/t/anki-24-10-beta/49989/150
This commit is contained in:
Damien Elmes 2024-10-11 23:34:38 +10:00
parent e79060487b
commit b3a85a6515
2 changed files with 3 additions and 5 deletions

View file

@ -17,9 +17,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
return match.remove();
}
const fontWeight = getComputedStyle(element).fontWeight;
const threshold = 700;
if (fontWeight && Number(fontWeight) >= threshold) {
const fontWeight = element.style.fontWeight;
if (fontWeight === "bold" || Number(fontWeight) >= 700) {
return match.clear((): void => {
if (
removeStyleProperties(element, "font-weight") &&

View file

@ -17,8 +17,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
return match.remove();
}
const fontStyle = getComputedStyle(element).fontStyle;
if (["italic", "oblique"].includes(fontStyle)) {
if (["italic", "oblique"].includes(element.style.fontStyle)) {
return match.clear((): void => {
if (
removeStyleProperties(element, "font-style") &&