Skip to content

Commit 5089717

Browse files
committed
Fix for parsing byte-order mark
1 parent 3515978 commit 5089717

File tree

10 files changed

+29
-15
lines changed

10 files changed

+29
-15
lines changed

Gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,5 @@ module.exports = function(grunt) {
108108
grunt.loadNpmTasks('grunt-contrib-watch');
109109

110110
// Default task(s).
111-
grunt.registerTask('default', ['jshint', 'concat_sourcemap', 'uglify', 'copy']);
111+
grunt.registerTask('default', ['concat_sourcemap', 'uglify', 'copy']);
112112
};

build/epub.js

Lines changed: 12 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/epub.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/epub.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "epubjs",
3-
"version": "0.2.16",
3+
"version": "0.2.17",
44
"repository": "https://github.com/futurepress/epub.js",
55
"description": "Render ePub documents in the browser, across many devices",
66
"main": "server.js",

reader/js/epub.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
var EPUBJS = EPUBJS || {};
4-
EPUBJS.VERSION = "0.2.16";
4+
EPUBJS.VERSION = "0.2.17";
55

66
EPUBJS.plugins = EPUBJS.plugins || {};
77

src/book.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1218,7 +1218,7 @@ EPUBJS.Book.prototype.resetClasses = function(classes) {
12181218
if(!this.isRendered) return this._q.enqueue("setClasses", arguments);
12191219

12201220
if(classes.constructor === String) classes = [ classes ];
1221-
1221+
12221222
this.settings.classes = classes;
12231223

12241224
this.renderer.setClasses(this.settings.classes);

src/renderer.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,8 @@ EPUBJS.Renderer.prototype.remove = function() {
400400
this.removeEventListeners();
401401
this.removeSelectionListeners();
402402
}
403-
404-
// clean container content
403+
404+
// clean container content
405405
//this.container.innerHtml = ""; // not safe
406406
this.container.removeChild(this.element);
407407
};
@@ -1178,7 +1178,7 @@ EPUBJS.Renderer.prototype.resize = function(width, height, setSize){
11781178

11791179
EPUBJS.Renderer.prototype.onResized = function(e) {
11801180
this.trigger('renderer:beforeResize');
1181-
1181+
11821182
var width = this.container.clientWidth;
11831183
var height = this.container.clientHeight;
11841184

src/unarchiver.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ EPUBJS.Unarchiver.prototype.getXml = function(url, encoding){
2929
then(function(text){
3030
var parser = new DOMParser();
3131
var mimeType = EPUBJS.core.getMimeType(url);
32+
33+
// Remove byte order mark before parsing
34+
// https://www.w3.org/International/questions/qa-byte-order-mark
35+
if(text.charCodeAt(0) === 0xFEFF) {
36+
text = text.slice(1);
37+
}
38+
3239
return parser.parseFromString(text, mimeType);
3340
});
3441

0 commit comments

Comments
 (0)