From 32afb79fd1fd4e22f98d7353d6aecaa11807af0e Mon Sep 17 00:00:00 2001 From: John Factotum <50942278+johnfactotum@users.noreply.github.com> Date: Mon, 27 Dec 2021 14:52:07 +0800 Subject: [PATCH] Fix ID assertion in section base CFI XML ID assertions should contain the `id` attribute of the element itself. Fixes #1236 --- src/packaging.js | 1 + src/spine.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/packaging.js b/src/packaging.js index 396b5d4..f20f918 100644 --- a/src/packaging.js +++ b/src/packaging.js @@ -167,6 +167,7 @@ class Packaging { // var manifestPropArray = manifestProps.length ? manifestProps.split(" ") : []; var itemref = { + "id" : item.getAttribute("id"), "idref" : idref, "linear" : item.getAttribute("linear") || "yes", "properties" : propArray, diff --git a/src/spine.js b/src/spine.js index 519b67c..ffe51e1 100644 --- a/src/spine.js +++ b/src/spine.js @@ -51,7 +51,7 @@ class Spine { var spineItem; item.index = index; - item.cfiBase = this.epubcfi.generateChapterComponent(this.spineNodeIndex, item.index, item.idref); + item.cfiBase = this.epubcfi.generateChapterComponent(this.spineNodeIndex, item.index, item.id); if (item.href) { item.url = resolver(item.href, true);