Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix spine node index in CFIs #584

Merged
merged 5 commits into from Mar 29, 2017
Merged

Fix spine node index in CFIs #584

merged 5 commits into from Mar 29, 2017

Conversation

bill-titus
Copy link
Contributor

A fix is needed in two places.
1.) packaging.js -> use "children" to find only elements rather than "childNode" which can sometimes return text nodes and comment nodes, depending on the format of package.opf.
2.) epubcfi.js -> multiple the spine index by 2 to conform to CFI rules.

NOTE: The existing code works due to these two bugs canceling each other out for cases when the package.opf is formatted with spacing and no comments (and hence including two nodes for every one element in the spine).

A fix is needed in two places.
1.) packaging.js -> use "children" to find only elements rather than "childNode" which can sometimes return text nodes and comment nodes, depending on the format of package.opf.
2.) epubcfi.js -> multiple the spine index by 2 to conform to CFI rules.

NOTE: The existing code works due to these two bugs canceling each other out for cases when the package.opf is formatted with spacing and no comments (and hence including two nodes for every one element in the spine).
@fchasen
Copy link
Contributor

fchasen commented Mar 29, 2017

This all looks good, thanks for tracking the issue down.

@fchasen fchasen merged commit 646a09a into futurepress:v0.3 Mar 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants