When detecting footnote link, do not cross block display boundaries

This commit is contained in:
Kovid Goyal 2015-12-31 13:54:18 +05:30
parent fed8adbcde
commit d1150b2887

View File

@ -63,6 +63,8 @@ is_footnote_link = (node, url, linked_to_anchors) ->
[x, num] = [node, 3] [x, num] = [node, 3]
while x and num > 0 while x and num > 0
style = window.getComputedStyle(x) style = window.getComputedStyle(x)
if not style.display not in ['inline', 'inline-block']
break
if style.verticalAlign in ['sub', 'super', 'top', 'bottom'] if style.verticalAlign in ['sub', 'super', 'top', 'bottom']
return true return true
x = x.parentNode x = x.parentNode
@ -72,7 +74,7 @@ is_footnote_link = (node, url, linked_to_anchors) ->
children = (x for x in node.childNodes when x.nodeType == Node.ELEMENT_NODE) children = (x for x in node.childNodes when x.nodeType == Node.ELEMENT_NODE)
if children.length == 1 if children.length == 1
style = window.getComputedStyle(children[0]) style = window.getComputedStyle(children[0])
if style.verticalAlign in ['sub', 'super', 'top', 'bottom'] if style.display in ['inline', 'inline-block'] and style.verticalAlign in ['sub', 'super', 'top', 'bottom']
return true return true
eid = node.getAttribute('id') or node.getAttribute('name') eid = node.getAttribute('id') or node.getAttribute('name')