From 2e30f3db35b212140c2d1ea0a3f6f5c570a08f32 Mon Sep 17 00:00:00 2001 From: John Factotum <50942278+johnfactotum@users.noreply.github.com> Date: Mon, 2 Dec 2024 17:55:26 +0800 Subject: [PATCH] Footnotes: improve superscript detection --- footnotes.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/footnotes.js b/footnotes.js index 22836f7..a1058cc 100644 --- a/footnotes.js +++ b/footnotes.js @@ -2,8 +2,12 @@ const getTypes = el => new Set(el?.getAttributeNS?.('http://www.idpf.org/2007/op const getRoles = el => new Set(el?.getAttribute?.('role')?.split(' ')) const isSuper = el => { + if (el.matches('sup')) return true const { verticalAlign } = getComputedStyle(el) - return verticalAlign === 'super' || /^\d/.test(verticalAlign) + return verticalAlign === 'super' + || verticalAlign === 'top' + || verticalAlign === 'text-top' + || /^\d/.test(verticalAlign) } const refTypes = ['biblioref', 'glossref', 'noteref']