mirror of
https://github.com/john-okeefe/foliate-js.git
synced 2026-09-09 11:29:14 -04:00
Add tests for EPUB CFI
This commit is contained in:
+1
-2
@@ -244,9 +244,8 @@ const partsToNode = (node, parts) => {
|
||||
let sum = 0
|
||||
for (const n of node) {
|
||||
const { length } = n.nodeValue
|
||||
if (sum + length > offset) return { node: n, offset: offset - sum }
|
||||
if (sum + length >= offset) return { node: n, offset: offset - sum }
|
||||
sum += length
|
||||
if (n === node[node.length - 1]) return { node: n, offset: length - 1 }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user