epub icon indicating copy to clipboard operation
epub copied to clipboard

TOC title properties are inaccurately defined as empty strings

Open phoenix-violeus opened this issue 6 years ago • 0 comments

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() : '';

phoenix-violeus avatar Sep 12 '18 22:09 phoenix-violeus