diff --git a/examples/highlights.html b/examples/highlights.html index 553ce5d..3f8bd9b 100644 --- a/examples/highlights.html +++ b/examples/highlights.html @@ -193,7 +193,7 @@ // Apply a class to selected text rendition.on("selected", function(cfiRange) { // Get the dom range of the selected text - var range = rendition.range(cfiRange); + var range = rendition.getRange(cfiRange); // Create an empty Rangy range var rr = rangy.createRange(); // Set that range to equal the dom range diff --git a/src/rendition.js b/src/rendition.js index c48c4bc..6c79e08 100644 --- a/src/rendition.js +++ b/src/rendition.js @@ -581,7 +581,7 @@ class Rendition { * @param {string} ignoreClass * @return {range} */ - range(cfi, ignoreClass){ + getRange(cfi, ignoreClass){ var _cfi = new EpubCFI(cfi); var found = this.manager.visible().filter(function (view) { if(_cfi.spinePos === view.index) return true; @@ -589,7 +589,7 @@ class Rendition { // Should only every return 1 item if (found.length) { - return found[0].range(_cfi, ignoreClass); + return found[0].contents.range(_cfi, ignoreClass); } }