strip qutoes from attribute value
This commit is contained in:
parent
c1d79047f2
commit
db9515d347
@ -35,7 +35,6 @@ impl Attribute {
|
|||||||
return Err("Expected expression.".into());
|
return Err("Expected expression.".into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
q @ '"' | q @ '\'' => parse_quoted_string(toks, scope, q, super_selector)?.to_string(),
|
|
||||||
_ => return Err("Expected identifier.".into()),
|
_ => return Err("Expected identifier.".into()),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -73,7 +72,7 @@ impl Attribute {
|
|||||||
v @ 'a'..='z' | v @ 'A'..='Z' | v @ '-' | v @ '_' => {
|
v @ 'a'..='z' | v @ 'A'..='Z' | v @ '-' | v @ '_' => {
|
||||||
format!("{}{}", v, eat_ident(toks, scope, super_selector)?)
|
format!("{}{}", v, eat_ident(toks, scope, super_selector)?)
|
||||||
}
|
}
|
||||||
q @ '"' | q @ '\'' => parse_quoted_string(toks, scope, q, super_selector)?.to_string(),
|
q @ '"' | q @ '\'' => parse_quoted_string(toks, scope, q, super_selector)?.unquote().to_string(),
|
||||||
_ => return Err("Expected identifier.".into()),
|
_ => return Err("Expected identifier.".into()),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -64,14 +64,20 @@ test!(
|
|||||||
selector_attribute_equals,
|
selector_attribute_equals,
|
||||||
"[attr=val] {\n color: red;\n}\n"
|
"[attr=val] {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
// test!(
|
test!(
|
||||||
// selector_attribute_single_quotes,
|
selector_attribute_single_quotes,
|
||||||
// "[attr='val'] {\n color: red;\n}\n",
|
"[attr='val'] {\n color: red;\n}\n",
|
||||||
// "[attr=val] {\n color: red;\n}\n"
|
"[attr=val] {\n color: red;\n}\n"
|
||||||
// );
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_attribute_double_quotes,
|
selector_attribute_double_quotes,
|
||||||
"[attr=\"val\"] {\n color: red;\n}\n"
|
"[attr=\"val\"] {\n color: red;\n}\n",
|
||||||
|
"[attr=val] {\n color: red;\n}\n"
|
||||||
|
);
|
||||||
|
error!(
|
||||||
|
attribute_attr_quoted,
|
||||||
|
"[\"attr\"=val] {\n color: red;\n}\n",
|
||||||
|
"Error: Expected identifier."
|
||||||
);
|
);
|
||||||
test!(selector_attribute_in, "[attr~=val] {\n color: red;\n}\n");
|
test!(selector_attribute_in, "[attr~=val] {\n color: red;\n}\n");
|
||||||
test!(
|
test!(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user