1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-04 15:09:16 +02:00

Parse nxcItem with namespace

Some Ncx files have a namespace. A normal navpoint looks like this:

```
<navPoint id="id3" playOrder="3">
```

But a namespaced navPoint looks like this:

```
<ncx:navPoint id="id3" playOrder="3">
```

This change will remove the namespace  of the nodeName. This way we'll get a properly nested TOC.
This commit is contained in:
Niels Lanting 2018-10-18 15:59:17 +02:00 committed by GitHub
parent 96141d1de3
commit 6333d008fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -296,7 +296,7 @@ class Navigation {
parentNode = item.parentNode,
parent;
if(parentNode && parentNode.nodeName === "navPoint") {
if(parentNode && (parentNode.nodeName === "navPoint" || parentNode.nodeName.split(':').slice(-1)[0] === "navPoint")) {
parent = parentNode.getAttribute("id");
}