Skip to content

Commit 71c11f8

Browse files
committed
src/prep_article.rs: revise fix_lazy_images
1 parent c77f6f4 commit 71c11f8

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
All notable changes to the `dom_smoothie` crate will be documented in this file.
44

5+
## [Unreleased]
6+
7+
### Changed
8+
- Updated the internal function `fix_lazy_images` to improve how it checks whether an element's class attribute contains the word `lazy`.
9+
510
## [0.9.0] - 2025-03-17
611

712
### Added

src/glob.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,3 +237,5 @@ pub(crate) static MINI_PRESENTATION: Lazy<MiniSelector> =
237237
Lazy::new(|| MiniSelector::new(r#"[role="presentation"]"#).unwrap());
238238
pub(crate) static MINI_AINT_DATA_TABLE: Lazy<MiniSelector> =
239239
Lazy::new(|| MiniSelector::new(r#"[datatable="0"]"#).unwrap());
240+
pub(crate) static MINI_LAZY: Lazy<MiniSelector> =
241+
Lazy::new(|| MiniSelector::new(r#"[class*="lazy"]"#).unwrap());

src/prep_article.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ fn fix_lazy_images(sel: &Selection) {
309309
}
310310
}
311311

312-
if (node.has_attr("src") || node.has_attr("srcset")) && !node.has_class("lazy") {
312+
if (node.has_attr("src") || node.has_attr("srcset")) && !MINI_LAZY.match_node(node) {
313313
continue;
314314
}
315315

0 commit comments

Comments
 (0)