1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-03 14:59:18 +02:00

Allow span in toc nav items

According to https://www.w3.org/publishing/epub32/epub-packages.html#sec-package-nav-def-model:

"A child `a` element describes the target that the link points to, while a `span` element serves as a heading for breaking down lists into distinct groups (for example, a large list of illustrations can be segmented into several lists, one for each chapter)."
This commit is contained in:
John Factotum 2021-12-16 15:11:55 +08:00
parent 228d9913e0
commit 1336e51c40

View file

@ -191,7 +191,8 @@ class Navigation {
*/
navItem(item, parent) {
let id = item.getAttribute("id") || undefined;
let content = filterChildren(item, "a", true);
let content = filterChildren(item, "a", true)
|| filterChildren(item, "span", true);
if (!content) {
return;