mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Dont use zero offset for element selections
This commit is contained in:
parent
366a69a3cd
commit
d2db909851
@ -793,7 +793,7 @@ def cfi_for_selection(r): # {{{
|
|||||||
nt = container.nodeType
|
nt = container.nodeType
|
||||||
if nt is Node.TEXT_NODE or nt is Node.CDATA_SECTION_NODE or nt is Node.COMMENT_NODE:
|
if nt is Node.TEXT_NODE or nt is Node.CDATA_SECTION_NODE or nt is Node.COMMENT_NODE:
|
||||||
return container, offset
|
return container, offset
|
||||||
if nt is Node.ELEMENT_NODE:
|
if nt is Node.ELEMENT_NODE and offset and container.childNodes.length > offset:
|
||||||
return container.childNodes[offset], 0
|
return container.childNodes[offset], 0
|
||||||
return container, offset
|
return container, offset
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user