diff --git a/Readability.js b/Readability.js index 3987162..13fde74 100644 --- a/Readability.js +++ b/Readability.js @@ -1316,6 +1316,19 @@ Readability.prototype = { return metadata; }, + /** + * Check if node is image, or if node contains exactly only one image + * whether as a direct child or as its descendants. + * + * @param Element + **/ + _isSingleImage: function(node) { + if (node.tagName === "IMG") return true; + if (node.children.length !== 1) return false; + if (node.textContent.trim() !== "") return false; + return this._isSingleImage(node.children[0]); + }, + /** * Find all