Footnotes: improve superscript detection

This commit is contained in:
John Factotum
2024-12-02 17:57:01 +08:00
parent 6f8eb1b85b
commit 2e30f3db35
+5 -1
View File
@@ -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 getRoles = el => new Set(el?.getAttribute?.('role')?.split(' '))
const isSuper = el => { const isSuper = el => {
if (el.matches('sup')) return true
const { verticalAlign } = getComputedStyle(el) 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'] const refTypes = ['biblioref', 'glossref', 'noteref']