diff --git a/src/Document.js b/src/Document.js index 05cf466..6f6066a 100644 --- a/src/Document.js +++ b/src/Document.js @@ -31,6 +31,8 @@ default: break; } + + this._hasContent = true; } else { this._original = new libxmljs.Document(); } @@ -81,9 +83,7 @@ return this._original.find(fullXPath, { [this.namespace.alias]: this.namespace.url }); } - fromHtml(html, options) { - if (!options) options = {}; - + fromHtml(html, options = {}) { if (typeof html !== 'string') throw new Error('html must be a string.'); if (typeof options !== 'object') throw new Error('options must be an object.'); @@ -93,9 +93,7 @@ return this; } - fromHtmlFragment(htmlFragment, options) { - if (!options) options = {}; - + fromHtmlFragment(htmlFragment, options = {}) { if (typeof htmlFragment !== 'string') throw new Error('htmlFragment must be a string.'); if (typeof options !== 'object') throw new Error('options must be an object.'); @@ -105,9 +103,7 @@ return this; } - fromXml(xml, options) { - if (!options) options = {}; - + fromXml(xml, options = {}) { if (typeof xml !== 'string') throw new Error('htmlFragment must be a string.'); if (typeof options !== 'object') throw new Error('options must be an object.');