escape colons within CSS idents

pull/162/head
Sunshine 4 years ago
parent ab601c3830
commit 9d3df2cdc6
No known key found for this signature in database
GPG Key ID: B80CA68703CD8AB1

@ -122,7 +122,7 @@ pub fn process_css<'a>(
}
Token::Ident(ref value) => {
curr_prop = str!(value);
result.push_str(value);
result.push_str(&value.replace(":", "\\:"));
}
Token::AtKeyword(ref value) => {
curr_rule = str!(value);

@ -209,7 +209,30 @@ div {\n \
transform: translate(50%, 50%) rotate(45deg);\n\
transform: translate(+50%, +50%) rotate(+45deg);\n\
}\n\
\n\
";
assert_eq!(
css::embed_css(
cache,
&client,
"https://doesntmatter.local/",
&CSS,
false,
true,
),
CSS
);
}
#[test]
fn passing_colons_in_class_names() {
let cache = &mut HashMap::new();
let client = Client::new();
const CSS: &str = "\
.is\\:good:hover {\n \
color: green\n\
}\n\
";
assert_eq!(

Loading…
Cancel
Save