From e85122e8d7622286293d75e3ca27ca7378b9cd4a Mon Sep 17 00:00:00 2001 From: Radhi Fadlillah Date: Tue, 31 Mar 2020 13:50:46 +0700 Subject: [PATCH] Make eslint happy --- Readability.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Readability.js b/Readability.js index fdd4fd4..4f5d687 100644 --- a/Readability.js +++ b/Readability.js @@ -1323,9 +1323,14 @@ Readability.prototype = { * @param Element **/ _isSingleImage: function(node) { - if (node.tagName === "IMG") return true; - if (node.children.length !== 1) return false; - if (node.textContent.trim() !== "") return false; + if (node.tagName === "IMG") { + return true; + } + + if (node.children.length !== 1 || node.textContent.trim() !== "") { + return false; + } + return this._isSingleImage(node.children[0]); }, @@ -1358,7 +1363,9 @@ Readability.prototype = { // Parse content of noscript and make sure it only contains image var tmp = doc.createElement("div"); tmp.innerHTML = noscript.innerHTML; - if (!this._isSingleImage(tmp)) return; + if (!this._isSingleImage(tmp)) { + return; + } // If noscript has previous sibling and it only contains image, // replace it with noscript content. However, in some case there