mirror of
https://github.com/john-okeefe/foliate-js.git
synced 2026-09-09 11:29:14 -04:00
Warn about parsing error
Falling back to HTML is good, but probably don't do it silently.
This commit is contained in:
@@ -513,6 +513,7 @@ class Loader {
|
||||
let doc = new DOMParser().parseFromString(str, mediaType)
|
||||
// change to HTML if it's not valid XHTML
|
||||
if (mediaType === MIME.XHTML && doc.querySelector('parsererror')) {
|
||||
console.warn(doc.querySelector('parsererror').innerText)
|
||||
item.mediaType = MIME.HTML
|
||||
doc = new DOMParser().parseFromString(str, item.mediaType)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user