E-book viewer: Fix a link that has some text along with a superscript/subscript being incorrectly detected as a footnote link

This commit is contained in:
Kovid Goyal 2016-04-11 04:20:55 +05:30
parent b20610910e
commit 6305d5c647
2 changed files with 3 additions and 1 deletions

Binary file not shown.

View File

@ -75,6 +75,8 @@ is_footnote_link = (node, url, linked_to_anchors) ->
if children.length == 1
style = window.getComputedStyle(children[0])
if style.display in ['inline', 'inline-block'] and style.verticalAlign in ['sub', 'super', 'top', 'bottom']
text_children = (x for x in node.childNodes when x.nodeType == Node.TEXT_NODE and x.nodeValue and /\S+/.test(x.nodeValue))
if not text_children.length
return true
eid = node.getAttribute('id') or node.getAttribute('name')