diff melonbooks-unlazy.user.js @ 98:3e5f1fa9ed52

Skip redundant class check and add dataset check instead
author nanaya <me@nanaya.net>
date Fri, 23 Dec 2022 19:58:14 +0900
parents c8f9350c5307
children b44d5cb661c5
line wrap: on
line diff
--- a/melonbooks-unlazy.user.js	Fri Dec 23 19:56:19 2022 +0900
+++ b/melonbooks-unlazy.user.js	Fri Dec 23 19:58:14 2022 +0900
@@ -13,7 +13,9 @@
 'use strict'
 
 function fix (image) {
-  if (!image.classList.contains('lazyload')) return
+  const src = image.dataset.src
+
+  if (src == null) return
 
   image.classList.remove('lazyload')
   image.src = image.dataset.src