Merge pull request #93 from TildenJ/fix-1

fix: resolves lazyload img bug (#92)
This commit is contained in:
指间的诗意 2021-04-27 15:28:57 +08:00 committed by GitHub
commit ff7501205e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -6,7 +6,7 @@ hexo.extend.filter.register(
if (!theme.lazyload || !theme.lazyload.enable) return; if (!theme.lazyload || !theme.lazyload.enable) return;
data.content = data.content.replace( data.content = data.content.replace(
// Match 'img' tags width the src attribute. // Match 'img' tags width the src attribute.
/<img([^>]*)src="([^"]*)"([^>]*)>/gim, /<img([^>]*)src="([^"]*)"([^>\/]*)\/?\s*>/gim,
function (match, attrBegin, src, attrEnd) { function (match, attrBegin, src, attrEnd) {
// Exit if the src doesn't exists. // Exit if the src doesn't exists.
if (!src) return match; if (!src) return match;