1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-03 14:59:18 +02:00

Updated request to parse DOM is xml is responseXML is not present

This commit is contained in:
Fred Chasen 2014-10-28 17:20:21 -04:00
parent 105a3a36d6
commit 239109dadb
4 changed files with 19 additions and 5 deletions

7
dist/epub.js vendored
View file

@ -2485,7 +2485,14 @@ EPUBJS.core.request = function(url, type, withCredentials, headers) {
var r;
if(type == 'xml'){
// If this.responseXML wasn't set, try to parse using a DOMParser from text
if(!this.responseXML){
r = new DOMParser().parseFromString(this.response, "text/xml");
} else {
r = this.responseXML;
}
}else
if(type == 'json'){
r = JSON.parse(this.response);

2
dist/epub.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -52,7 +52,14 @@ EPUBJS.core.request = function(url, type, withCredentials, headers) {
var r;
if(type == 'xml'){
// If this.responseXML wasn't set, try to parse using a DOMParser from text
if(!this.responseXML){
r = new DOMParser().parseFromString(this.response, "text/xml");
} else {
r = this.responseXML;
}
}else
if(type == 'json'){
r = JSON.parse(this.response);

View file

@ -286,7 +286,7 @@ asyncTest("Get all TOC", 1, function() {
});
asyncTest("Get TOC time by href", 1, function() {
asyncTest("Get TOC item by href", 1, function() {
var book = ePub("../books/moby-dick/OPS/package.opf");
book.loaded.navigation.then(function(){
@ -297,7 +297,7 @@ asyncTest("Get TOC time by href", 1, function() {
});
asyncTest("Get TOC time by ID", 1, function() {
asyncTest("Get TOC item by ID", 1, function() {
var book = ePub("../books/moby-dick/OPS/package.opf");
book.loaded.navigation.then(function(){