Skip to main content

resolve_lenient

Function resolve_lenient 

Source
pub fn resolve_lenient(
    src: &str,
    vars: &HashMap<String, String>,
) -> LenientResolution
Expand description

Same substitution as resolve, but never fails: an unresolvable var() call (unknown name with no fallback, unterminated call, or a recursion/cycle depth over 16) degrades to an empty string and records a message in LenientResolution::warnings, instead of aborting the rest of src.

This mirrors how the CSS cascade (lumen_ir::css::apply_to_element) treats an unresolvable var() in a stylesheet declaration: the one declaration is dropped and a crate::css::CssWarning is recorded, but the rest of the stylesheet still applies. resolve (strict) has no per-declaration boundary to drop at when it runs over a whole document (e.g. markup text carrying many attributes) rather than one declaration value, so this variant drops per-call instead and never returns Err.