From 4bb77e1ee800738584c23cc249f5eaa74529ec7d Mon Sep 17 00:00:00 2001 From: sqwishy Date: Sat, 4 Nov 2023 15:19:39 -0700 Subject: [PATCH] atlast.html line height, drop URL.canParse URL.canParse is not well supported in many browsers so try-catch instead --- atlast.html | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/atlast.html b/atlast.html index 08ac772..1d0dadc 100644 --- a/atlast.html +++ b/atlast.html @@ -4,7 +4,7 @@ html { background: var(--pale); color: #fbf1f7; - font: 18px 'Tex Gyre Adventor', corbel, sans-serif } + font: 18px/1.25 'Tex Gyre Adventor', corbel, sans-serif } body { min-height: 100%; @@ -239,8 +239,13 @@

About

function loadExternalFont({ setExternalFont, setExternalFontStatus }) { let { value } = document.querySelector("#externalFontUrl") - if (URL.canParse(value)) - value = `url(${value})` + + /* the external font value should be `url({url})`, + * if we just got a url then surround it in "url()" */ + try { + if (new URL(value)) + value = `url(${value})` + } catch (_) { } const [oldFont, newFont] = setExternalFont(value ? new FontFace("External", value) : null);