Workaround for some element nodes not having dataset

This commit is contained in:
Kovid Goyal 2021-06-30 07:41:45 +05:30
parent 9a6b7ae923
commit ac0969b9e9
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -249,7 +249,7 @@ def node_at_index(nodes, target, index, iter_text_nodes):
for i in range(nodes.length): for i in range(nodes.length):
node = nodes[i] node = nodes[i]
is_element = node.nodeType is Node.ELEMENT_NODE is_element = node.nodeType is Node.ELEMENT_NODE
if is_element and node.dataset.calibreRangeWrapper: if is_element and node.dataset?.calibreRangeWrapper:
q, index = node_at_index(unwrapped_nodes(node), target, index, iter_text_nodes) q, index = node_at_index(unwrapped_nodes(node), target, index, iter_text_nodes)
if q: if q:
return q, index return q, index