use crate::dom::{Document, NodeId};
pub(crate) fn get_node_ancestors(doc: &Document, id: NodeId, ancestor_tag: &str) -> Vec<NodeId> {
let mut ancestors = Vec::new();
let mut cur = id;
while let Some(parent) = doc.parent(cur) {
if doc.tag_name(parent) == ancestor_tag {
ancestors.push(parent);
}
cur = parent;
}
ancestors
}
#[inline]
pub(crate) fn contains(s: &str, substr: &str) -> bool {
s.contains(substr)
}
#[inline]
pub(crate) fn starts_with(s: &str, prefix: &str) -> bool {
s.starts_with(prefix)
}
#[inline]
pub(crate) fn lower(s: &str) -> String {
s.to_lowercase()
}