epub
epub copied to clipboard
TOC title properties are inaccurately defined as empty strings
The following ternary (lines 529-530 of epub.js) defines title as an empty string even when the given TOC title is truthy:
title = branch[i].navLabel && branch[i].navLabel.text || branch[i].navLabel===branch[i].navLabel ? '' : (branch[i].navLabel && branch[i].navLabel.text || branch[i].navLabel || "").trim();
Unless I'm mistaken, the solution is a simple matter of switching the expressions like so:
title = branch[i].navLabel && branch[i].navLabel.text || branch[i].navLabel===branch[i].navLabel ? (branch[i].navLabel && branch[i].navLabel.text || branch[i].navLabel || '').trim() : '';