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

View file

@ -52,7 +52,14 @@ EPUBJS.core.request = function(url, type, withCredentials, headers) {
var r;
if(type == 'xml'){
r = this.responseXML;
// 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);