use dom_query::Matcher;
use once_cell::sync::Lazy;
pub static SELECTORS: Lazy<Selectors> = Lazy::new(Selectors::new);
#[derive(Clone)]
pub struct Selectors {
pub body: Matcher,
pub html: Matcher,
pub title: Matcher,
pub meta: Matcher,
pub p: Matcher,
pub br: Matcher,
pub h1: Matcher,
pub h1_h2: Matcher,
pub img: Matcher,
pub li: Matcher,
pub table: Matcher,
pub ul_ol: Matcher,
pub script_noscript: Matcher,
pub style: Matcher,
pub font: Matcher,
pub noscript: Matcher,
pub caption: Matcher,
pub itemprop: Matcher,
pub img_picture_figure: Matcher,
pub img_picture: Matcher,
pub table_data_elements: Matcher,
pub json_ld_script: Matcher,
pub form: Matcher,
pub fieldset: Matcher,
pub div: Matcher,
}
impl Selectors {
pub fn new() -> Self {
Self {
body: Matcher::new("body").unwrap(),
html: Matcher::new("html").unwrap(),
title: Matcher::new("title").unwrap(),
meta: Matcher::new("meta").unwrap(),
p: Matcher::new("p").unwrap(),
br: Matcher::new("br").unwrap(),
h1: Matcher::new("h1").unwrap(),
h1_h2: Matcher::new("h1, h2").unwrap(),
img: Matcher::new("img").unwrap(),
li: Matcher::new("li").unwrap(),
table: Matcher::new("table").unwrap(),
ul_ol: Matcher::new("ul, ol").unwrap(),
script_noscript: Matcher::new("script, noscript").unwrap(),
style: Matcher::new("style").unwrap(),
font: Matcher::new("font").unwrap(),
noscript: Matcher::new("noscript").unwrap(),
caption: Matcher::new("caption").unwrap(),
itemprop: Matcher::new("[itemprop*='name']").unwrap(),
img_picture_figure: Matcher::new("img, picture, figure").unwrap(),
img_picture: Matcher::new("img, picture").unwrap(),
table_data_elements: Matcher::new("col, colgroup, tfoot, thead, th").unwrap(),
json_ld_script: Matcher::new("script[type='application/ld+json']").unwrap(),
form: Matcher::new("form").unwrap(),
fieldset: Matcher::new("fieldset").unwrap(),
div: Matcher::new("div").unwrap(),
}
}
}
impl Default for Selectors {
fn default() -> Self {
Self::new()
}
}