hypothesis/dom-text-mapper — pull request #13 by csillag (2013-11-11 22:23:16+00:00)
Title: Big API change + support for multi-page document access

API changes:
* NEW: getCorpus() returns the corpus
* NEW: _updateMap() updates the mappings
* NEW: _testMap() does some consistency checking
* NEW: stub methods for simulating page-based, lazy rendered environment.
(Used by two-phased anchoring in Annotator.)
* getPageIndex()
* getPageCount()
* getPageIndexForPos()
* isPageMapped()
* CHANGED: constructor now accepts a text ID, used for logging
* CHANGED: getMappingsForCharRange() now accepts a list of page indexes
to look at, and also returns the results on a per-page basis
* CHANGED: the static @changed() method now accepts arbitrary data
* CHANGED: getInfoForNode() now returns page number, too
* REMOVED: postProcess() hook
* REMOVED: getDocLength() (use getCorpus())
* REMOVED: getContentForCharRange (use getCorpus())

Changed behavior:
* The change notification events now set the lastDOMChange
and lastScanned flags, to avoid unnecessary re-scannings.
The drawback is that we might miss independent changes,
but those are not yet handled properly anyway.

Internal changes:
* Changed internal logging
* Many cosmetic changes and debugging improvements
* Small internal simplifications