Skip to content

Commit

Permalink
Stop using live list while removing nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
RadhiFadlillah authored and gijsk committed Apr 3, 2020
1 parent 1277d22 commit c8eab07
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Readability.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
Expand Down

0 comments on commit c8eab07

Please sign in to comment.