diff --git a/scripts/filters/lazyload-handle.js b/scripts/filters/lazyload-handle.js index 83bdfb3..985ef98 100644 --- a/scripts/filters/lazyload-handle.js +++ b/scripts/filters/lazyload-handle.js @@ -11,9 +11,12 @@ hexo.extend.filter.register( // Match 'img' tags the src attribute. /]*)src="([^"]*)"([^>\/]*)\/?\s*>/gim, function (match, attrBegin, src, attrEnd) { + let hasAlt = false if (!src) return match + ;[attrBegin, attrEnd].forEach(x => { if (x.includes('alt="')) { hasAlt = true } }) return ``