From c8eab07661ffc0ab161acc86e2593553a56e311d Mon Sep 17 00:00:00 2001 From: Radhi Fadlillah Date: Tue, 31 Mar 2020 13:47:25 +0700 Subject: [PATCH] Stop using live list while removing nodes --- Readability.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Readability.js b/Readability.js index 639333d..fdd4fd4 100644 --- a/Readability.js +++ b/Readability.js @@ -1340,7 +1340,7 @@ Readability.prototype = { _unwrapNoscriptImages: function(doc) { // Find img without source and remove it. This is done to prevent a placeholder // img is replaced by img from noscript in next step. - var imgs = doc.getElementsByTagName("img"); + var imgs = Array.from(doc.getElementsByTagName("img")); this._forEachNode(imgs, function(img) { var src = img.getAttribute("src"); var srcset = img.getAttribute("srcset"); @@ -1353,7 +1353,7 @@ Readability.prototype = { }); // Next find noscript and try to extract its image - var noscripts = doc.getElementsByTagName("noscript"); + var noscripts = Array.from(doc.getElementsByTagName("noscript")); this._forEachNode(noscripts, function(noscript) { // Parse content of noscript and make sure it only contains image var tmp = doc.createElement("div");