pub fn filter<F>(doc: &Document, keep: F)Expand description
Filter links based on predicate.
Removes all <a> tags that don’t match the predicate.
§Example
use html_cleaning::links;
use dom_query::Document;
let doc = Document::from(r#"<a href="https://good.com">Keep</a><a href="https://bad.com">Remove</a>"#);
links::filter(&doc, |sel| {
sel.attr("href").map(|h| h.contains("good")).unwrap_or(false)
});
assert_eq!(doc.select("a").length(), 1);