Fix grammar issues in comments

pull/607/head
Radhi Fadlillah 4 years ago committed by Gijs
parent 89572ad29a
commit adc6accaec

@ -1317,10 +1317,10 @@ Readability.prototype = {
},
/**
* Find all <noscript> that located after <img> node, and contains exactly
* single <img> element. Once it found, this method will replace the previous <img>
* with <img> inside <noscript>, then finally remove the <noscript> tag. This is
* done because in some website (e.g. Medium), they use lazy load method like this.
* Find all <noscript> that are located after <img> nodes, and which contain only one
* <img> element. Replace the first image with the image from inside the <noscript> tag,
* and remove the <noscript> tag. This improves the quality of the images we use on
* some sites (e.g. Medium).
*
* @param Element
**/
@ -1350,17 +1350,18 @@ Readability.prototype = {
// Next find noscript and try to extract its image
var noscripts = doc.getElementsByTagName("noscript");
this._forEachNode(noscripts, function(noscript) {
// Make sure prev sibling is exist and it's image
// Make sure prev sibling exists and it's image
var prevElement = noscript.previousElementSibling;
if (prevElement == null || prevElement.tagName !== "IMG") {
return;
}
// In jsdom content of noscript is treated as string, so here we parse it.
// In spec-compliant browser, content of noscript is treated as
// string so here we parse it.
var tmp = doc.createElement("div");
tmp.innerHTML = noscript.innerHTML;
// Make sure noscript only has one children, and it's <img> element
// Make sure noscript only has one child, and it's <img> element
var children = tmp.children;
if (children.length != 1 || children[0].tagName !== "IMG") {
return;

Loading…
Cancel
Save