diff --git a/crates/usvg/src/parser/svgtree/parse.rs b/crates/usvg/src/parser/svgtree/parse.rs index e1c33d4b..640be1d3 100644 --- a/crates/usvg/src/parser/svgtree/parse.rs +++ b/crates/usvg/src/parser/svgtree/parse.rs @@ -376,8 +376,12 @@ pub(crate) fn parse_svg_element<'input>( .collect::>(); if iss.has_priority { + // Injected stylesheet should have priority, meaning we just add the declarations + // to the end of the vector. Later-appearing declarations will override previous ones. declarations.extend(injected_declarations) } else { + // In this case, we prepend the injected declarations so that they will be overwritten + // by the ones defined in the SVG. injected_declarations.extend(declarations); declarations = injected_declarations; }