Compare annotation locations by CFI and text position
For annotations on EPUBs, text position selectors can only be validly compared when they come from annotations made on the same EPUB Content Document. For annotations that come from different content documents, it is necessary to first compare the ordering of the content documents using CFIs, and then compare text positions. The use of `Number.POSITIVE_INFINITY` with replaced with `Number.MAX_SAFE_INTEGER` when handling annotations without positions, as `Math.sign(MAX_SAFE_INTEGER - MAX_SAFE_INTEGER)` is 0 (ie. treat two annotations with missing positions as having the same position), but `Math.sign(POSITIVE_INFINITY - POSITIVE_INFINITY)` is NaN.
Showing
Please register or sign in to comment