diff --git a/src/moz_readability/mod.rs b/src/moz_readability/mod.rs index 38236d3..705fa55 100644 --- a/src/moz_readability/mod.rs +++ b/src/moz_readability/mod.rs @@ -1248,8 +1248,7 @@ impl Readability { let srcset = node_attr.get("srcset"); let class = node_attr.get("class"); if (src.is_some() || srcset.is_some()) - && class.is_some() - && !class.unwrap().contains("lazy") + && class.and_then(|classname| classname.find("lazy")).is_none() { continue; } @@ -3160,6 +3159,7 @@ characters. For that reason, this

tag could not be a byline because it's too Flowers + "#; @@ -3189,6 +3189,13 @@ characters. For that reason, this

tag could not be a byline because it's too lazy_loaded_attrs.get("data-src"), lazy_loaded_attrs.get("src") ); + + let no_lazy_class = doc.root_node.select_first("#no-lazy-class").unwrap(); + let no_lazy_class_attrs = no_lazy_class.attributes.borrow(); + assert_eq!( + no_lazy_class_attrs.get("src").unwrap(), + "https://image.url/" + ); } #[test]