Merge pull request #162 from snshn/colons-in-css-class-names

Escape colons within CSS idents
pull/163/head
Sunshine 4 years ago committed by GitHub
commit cc6dbddb49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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