CFI element blacklisting

2 posts / 0 new
Last post

In cfi_instructions.js there is a method called applyBlacklist which is used in CFI navigation to ignore elements when addressing a CFI. This allows one to inject an element into the DOM while ignoring it for CFI purposes.

However, there are some cases where applyBlacklist would not work. applyBlacklist removes the entire subtree from the element that is blacklisted. If the injected element surrounds original content (for instance in the case of a span tag to highlight text in a spine item), any content surrounded by the span tag is no longer CFI addressable which would also lead to calculation of further CFIs to be incorrect.

I have altered applyBlacklist to instead only ignore those elements directly marked for the blacklist. Any children of the element not marked for blacklist are logically promoted to the spot of the blacklisted parent.

This means that all elements that should be blacklisted must be directly marked (subtrees are no longer automatically filtered out), but it also means one can wrap content in tags and it will not affect addressing those elements via CFI.

I think this is necessary for highlighting and notes functionality. I can put together a pull request if this is something you're interested in merging.

Marcus Wu
BiblioLabs, LLC

Could you please re-post this in our github issues page here:

Ric Wright, Readium Foundation

Secondary menu