diff --git a/src/contents.js b/src/contents.js index b061422..6eba0b0 100644 --- a/src/contents.js +++ b/src/contents.js @@ -406,8 +406,10 @@ class Contents { } } - } else if(typeof target === "string") { - let id = target; + } else if(typeof target === "string" && + target.indexOf("#") > -1) { + + let id = target.substring(target.indexOf("#")+1); let el = this.document.getElementById(id); if(el) { diff --git a/src/rendition.js b/src/rendition.js index 0214a81..560371b 100644 --- a/src/rendition.js +++ b/src/rendition.js @@ -239,18 +239,7 @@ class Rendition { return displayed; } - // Trim the target fragment - // removing the chapter - if(!isCfiString && typeof target === "string" && - target.indexOf("#") > -1) { - moveTo = target.substring(target.indexOf("#")+1); - } - - if (isCfiString) { - moveTo = target; - } - - return this.manager.display(section, moveTo) + return this.manager.display(section, target) .then(function(){ // this.emit("displayed", section); }.bind(this));