escape colons within CSS idents
This commit is contained in:
parent
ab601c3830
commit
9d3df2cdc6
2 changed files with 25 additions and 2 deletions
|
@ -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…
Reference in a new issue