Better naming for this parsing function

This commit is contained in:
Jackson Harper
2022-02-18 15:34:38 -08:00
parent 8756a52a54
commit 603e9683db

View File

@ -512,15 +512,15 @@ Readability.prototype = {
if (src) {
const absoluteSrc = this.toAbsoluteURI(src);
const parseNumber = (str) => {
const attToNumber = (str) => {
if (!str) { return 0; }
const res = parseNumber(str);
const res = parseInt(str);
if (isNaN(res)) { return 0; }
return res
}
const width = parseInt(image.getAttribute('width') || image.style.width);
const height = parseInt(image.getAttribute('height') || image.style.height);
const width = attToNumber(image.getAttribute('width') || image.style.width);
const height = attToNumber(image.getAttribute('height') || image.style.height);
const proxySrc = this.createImageProxyUrl(absoluteSrc, width, height);
image.setAttribute('src', proxySrc);