mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-05 15:32:55 +02:00
Merge pull request #819 from wiscat/fix_epubcfi_null
fix EpubCFI(null) Uncaught TypeError: Cannot read property 'startCont…
This commit is contained in:
commit
ac6807b26b
1 changed files with 3 additions and 3 deletions
|
@ -77,11 +77,11 @@ class EpubCFI {
|
||||||
if (this.isCfiString(cfi)) {
|
if (this.isCfiString(cfi)) {
|
||||||
return "string";
|
return "string";
|
||||||
// Is a range object
|
// Is a range object
|
||||||
} else if (typeof cfi === "object" && (type(cfi) === "Range" || typeof(cfi.startContainer) != "undefined")){
|
} else if (cfi && typeof cfi === "object" && (type(cfi) === "Range" || typeof(cfi.startContainer) != "undefined")){
|
||||||
return "range";
|
return "range";
|
||||||
} else if (typeof cfi === "object" && typeof(cfi.nodeType) != "undefined" ){ // || typeof cfi === "function"
|
} else if (cfi && typeof cfi === "object" && typeof(cfi.nodeType) != "undefined" ){ // || typeof cfi === "function"
|
||||||
return "node";
|
return "node";
|
||||||
} else if (typeof cfi === "object" && cfi instanceof EpubCFI){
|
} else if (cfi && typeof cfi === "object" && cfi instanceof EpubCFI){
|
||||||
return "EpubCFI";
|
return "EpubCFI";
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue