1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-05 15:32:55 +02:00

Removed 3rd argument of document.implementation.createDocument for iOS

This commit is contained in:
Fred Chasen 2014-07-25 09:05:45 -04:00
parent 1af6322367
commit 5700a10b54
9 changed files with 45 additions and 25 deletions

View file

@ -3540,6 +3540,7 @@ EPUBJS.Chapter.prototype.load = function(_store){
promise.then(function(xml){ promise.then(function(xml){
this.setDocument(xml); this.setDocument(xml);
this.deferred.resolve(this);
}.bind(this)); }.bind(this));
return promise; return promise;
@ -3600,17 +3601,21 @@ EPUBJS.Chapter.prototype.unload = function(store){
}; };
EPUBJS.Chapter.prototype.setDocument = function(_document){ EPUBJS.Chapter.prototype.setDocument = function(_document){
var uri = _document.namespaceURI;
// var doctype = _document.doctype;
// Creates an empty document
this.document = _document.implementation.createDocument( this.document = _document.implementation.createDocument(
_document.namespaceURI, //namespace to use uri,
null, //empty document null
_document.doctype //doctype (null for XML)
); );
this.contents = this.document.importNode( this.contents = this.document.importNode(
_document.documentElement, //node to import _document.documentElement, //node to import
true //clone its descendants true //clone its descendants
); );
this.document.appendChild(this.contents); this.document.appendChild(this.contents);
this.deferred.resolve(this.contents); // this.deferred.resolve(this.contents);
}; };
EPUBJS.Chapter.prototype.cfiFromRange = function(_range) { EPUBJS.Chapter.prototype.cfiFromRange = function(_range) {
@ -3727,7 +3732,7 @@ EPUBJS.Chapter.prototype.find = function(_query){
EPUBJS.Chapter.prototype.textSprint = function(root, func) { EPUBJS.Chapter.prototype.textSprint = function(root, func) {
var treeWalker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, { var treeWalker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, {
acceptNode: function (node) { acceptNode: function (node) {
if ( ! /^\s*$/.test(node.data) ) { if (node.data && ! /^\s*$/.test(node.data) ) {
return NodeFilter.FILTER_ACCEPT; return NodeFilter.FILTER_ACCEPT;
} else { } else {
return NodeFilter.FILTER_REJECT; return NodeFilter.FILTER_REJECT;

File diff suppressed because one or more lines are too long

2
build/epub.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -3539,6 +3539,7 @@ EPUBJS.Chapter.prototype.load = function(_store){
promise.then(function(xml){ promise.then(function(xml){
this.setDocument(xml); this.setDocument(xml);
this.deferred.resolve(this);
}.bind(this)); }.bind(this));
return promise; return promise;
@ -3599,17 +3600,21 @@ EPUBJS.Chapter.prototype.unload = function(store){
}; };
EPUBJS.Chapter.prototype.setDocument = function(_document){ EPUBJS.Chapter.prototype.setDocument = function(_document){
var uri = _document.namespaceURI;
// var doctype = _document.doctype;
// Creates an empty document
this.document = _document.implementation.createDocument( this.document = _document.implementation.createDocument(
_document.namespaceURI, //namespace to use uri,
null, //empty document null
_document.doctype //doctype (null for XML)
); );
this.contents = this.document.importNode( this.contents = this.document.importNode(
_document.documentElement, //node to import _document.documentElement, //node to import
true //clone its descendants true //clone its descendants
); );
this.document.appendChild(this.contents); this.document.appendChild(this.contents);
this.deferred.resolve(this.contents); // this.deferred.resolve(this.contents);
}; };
EPUBJS.Chapter.prototype.cfiFromRange = function(_range) { EPUBJS.Chapter.prototype.cfiFromRange = function(_range) {
@ -3726,7 +3731,7 @@ EPUBJS.Chapter.prototype.find = function(_query){
EPUBJS.Chapter.prototype.textSprint = function(root, func) { EPUBJS.Chapter.prototype.textSprint = function(root, func) {
var treeWalker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, { var treeWalker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, {
acceptNode: function (node) { acceptNode: function (node) {
if ( ! /^\s*$/.test(node.data) ) { if (node.data && ! /^\s*$/.test(node.data) ) {
return NodeFilter.FILTER_ACCEPT; return NodeFilter.FILTER_ACCEPT;
} else { } else {
return NodeFilter.FILTER_REJECT; return NodeFilter.FILTER_REJECT;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

15
reader/js/epub.min.js vendored
View file

@ -3540,6 +3540,7 @@ EPUBJS.Chapter.prototype.load = function(_store){
promise.then(function(xml){ promise.then(function(xml){
this.setDocument(xml); this.setDocument(xml);
this.deferred.resolve(this);
}.bind(this)); }.bind(this));
return promise; return promise;
@ -3600,17 +3601,21 @@ EPUBJS.Chapter.prototype.unload = function(store){
}; };
EPUBJS.Chapter.prototype.setDocument = function(_document){ EPUBJS.Chapter.prototype.setDocument = function(_document){
var uri = _document.namespaceURI;
// var doctype = _document.doctype;
// Creates an empty document
this.document = _document.implementation.createDocument( this.document = _document.implementation.createDocument(
_document.namespaceURI, //namespace to use uri,
null, //empty document null
_document.doctype //doctype (null for XML)
); );
this.contents = this.document.importNode( this.contents = this.document.importNode(
_document.documentElement, //node to import _document.documentElement, //node to import
true //clone its descendants true //clone its descendants
); );
this.document.appendChild(this.contents); this.document.appendChild(this.contents);
this.deferred.resolve(this.contents); // this.deferred.resolve(this.contents);
}; };
EPUBJS.Chapter.prototype.cfiFromRange = function(_range) { EPUBJS.Chapter.prototype.cfiFromRange = function(_range) {
@ -3727,7 +3732,7 @@ EPUBJS.Chapter.prototype.find = function(_query){
EPUBJS.Chapter.prototype.textSprint = function(root, func) { EPUBJS.Chapter.prototype.textSprint = function(root, func) {
var treeWalker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, { var treeWalker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, {
acceptNode: function (node) { acceptNode: function (node) {
if ( ! /^\s*$/.test(node.data) ) { if (node.data && ! /^\s*$/.test(node.data) ) {
return NodeFilter.FILTER_ACCEPT; return NodeFilter.FILTER_ACCEPT;
} else { } else {
return NodeFilter.FILTER_REJECT; return NodeFilter.FILTER_REJECT;

View file

@ -27,6 +27,7 @@ EPUBJS.Chapter.prototype.load = function(_store){
promise.then(function(xml){ promise.then(function(xml){
this.setDocument(xml); this.setDocument(xml);
this.deferred.resolve(this);
}.bind(this)); }.bind(this));
return promise; return promise;
@ -87,17 +88,21 @@ EPUBJS.Chapter.prototype.unload = function(store){
}; };
EPUBJS.Chapter.prototype.setDocument = function(_document){ EPUBJS.Chapter.prototype.setDocument = function(_document){
var uri = _document.namespaceURI;
// var doctype = _document.doctype;
// Creates an empty document
this.document = _document.implementation.createDocument( this.document = _document.implementation.createDocument(
_document.namespaceURI, //namespace to use uri,
null, //empty document null
_document.doctype //doctype (null for XML)
); );
this.contents = this.document.importNode( this.contents = this.document.importNode(
_document.documentElement, //node to import _document.documentElement, //node to import
true //clone its descendants true //clone its descendants
); );
this.document.appendChild(this.contents); this.document.appendChild(this.contents);
this.deferred.resolve(this.contents); // this.deferred.resolve(this.contents);
}; };
EPUBJS.Chapter.prototype.cfiFromRange = function(_range) { EPUBJS.Chapter.prototype.cfiFromRange = function(_range) {
@ -214,7 +219,7 @@ EPUBJS.Chapter.prototype.find = function(_query){
EPUBJS.Chapter.prototype.textSprint = function(root, func) { EPUBJS.Chapter.prototype.textSprint = function(root, func) {
var treeWalker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, { var treeWalker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, {
acceptNode: function (node) { acceptNode: function (node) {
if ( ! /^\s*$/.test(node.data) ) { if (node.data && ! /^\s*$/.test(node.data) ) {
return NodeFilter.FILTER_ACCEPT; return NodeFilter.FILTER_ACCEPT;
} else { } else {
return NodeFilter.FILTER_REJECT; return NodeFilter.FILTER_REJECT;