mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-03 14:59:18 +02:00
check that cfi is string before finding indexOf
This commit is contained in:
parent
ac926479cf
commit
d896d8c228
4 changed files with 9 additions and 5 deletions
6
dist/epub.js
vendored
6
dist/epub.js
vendored
|
@ -5227,7 +5227,8 @@ EPUBJS.Rendition.prototype._display = function(target){
|
|||
var view;
|
||||
var cfi, spinePos;
|
||||
|
||||
if(target.indexOf("epubcfi(") === 0) {
|
||||
if(typeof target === "string" &&
|
||||
target.indexOf("epubcfi(") === 0) {
|
||||
cfi = new EPUBJS.EpubCFI(target);
|
||||
spinePos = cfi.spinePos;
|
||||
section = this.book.spine.get(spinePos);
|
||||
|
@ -5703,7 +5704,8 @@ EPUBJS.Continuous.prototype._display = function(target){
|
|||
var view;
|
||||
var cfi, spinePos;
|
||||
|
||||
if(target.indexOf("epubcfi(") === 0) {
|
||||
if(typeof target === "string" &&
|
||||
target.indexOf("epubcfi(") === 0) {
|
||||
cfi = new EPUBJS.EpubCFI(target);
|
||||
spinePos = cfi.spinePos;
|
||||
section = this.book.spine.get(spinePos);
|
||||
|
|
2
dist/epub.min.js
vendored
2
dist/epub.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -48,7 +48,8 @@ EPUBJS.Continuous.prototype._display = function(target){
|
|||
var view;
|
||||
var cfi, spinePos;
|
||||
|
||||
if(target.indexOf("epubcfi(") === 0) {
|
||||
if(typeof target === "string" &&
|
||||
target.indexOf("epubcfi(") === 0) {
|
||||
cfi = new EPUBJS.EpubCFI(target);
|
||||
spinePos = cfi.spinePos;
|
||||
section = this.book.spine.get(spinePos);
|
||||
|
|
|
@ -169,7 +169,8 @@ EPUBJS.Rendition.prototype._display = function(target){
|
|||
var view;
|
||||
var cfi, spinePos;
|
||||
|
||||
if(target.indexOf("epubcfi(") === 0) {
|
||||
if(typeof target === "string" &&
|
||||
target.indexOf("epubcfi(") === 0) {
|
||||
cfi = new EPUBJS.EpubCFI(target);
|
||||
spinePos = cfi.spinePos;
|
||||
section = this.book.spine.get(spinePos);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue