readium/readium-cfi-js — pull request #19 by marcuswu (2014-11-04 15:54:53+00:00)
Title: Blacklist without subtree

There are some use cases where applyBlacklist does not work. applyBlacklist removes the entire subtree starting 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 CFIs within the wrapped content 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 had these committed in our own fork for some time and I noticed that those commits also have some other random fixes integrated in them. Sorry, but I didn't see an easy way to tease those out. If desired, I can squash these into one commit.

Since this departs from existing functionality, I fully expect some conversation surrounding these changes and I welcome it.