-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
a:hover {}
is invalid css
#147
Comments
@simbleau should the I've also found that stylist's ability to use bare css doesn't work in all cases: sometimes you'll need to switch to a stringified style ala: css!(r#"
a:hover {
color: white;
}
#") |
AFAIK there is no difference between And yes, the stringify way works, but isn't addressing the problem. |
TIL these are interchangeable!
EDIT: Turns out I was completely wrong here -- diving in a bit deeper, this is totally supposed to be supported! Apologies for the confusion! |
The parsing code in stylist-rs/packages/stylist-macros/src/inline/parse/scope_content.rs Lines 33 to 42 in 74e0fd0
a : hover is (the start of) an attribute declaration, not the block qualifier that is should be parsed as. Note that {} blocks are considered a potentially valid part of an attribute value, too. 1 Hence, the whole thing is parsed as one attribute, with a missing terminating semicolon at the end.
The correct decision probably needs to reparse a potentially unbounded part of the input; Both You can, with probably good enough browser support, rewrite this as :is(a):hover {
} Note that generating class names tries to encourage you to not depend on the element type of the annotated element - hence why such an example is not shown. I suppose, in this case, you are trying to fix some global browser dictated style for Footnotes |
Yes, in my case, this is the website's (global) style. |
If this <a
class={
css! {
/* Other example styles */
background-color: black;
:hover {
color: white;
}
}
}
/> You can also try the string literal way, by putting all the |
I get a cryptic message with the following:
Error:
unexpected end of input, AttributeValue: unexpected end of input
If you change
a:hover
to anything else it works.The text was updated successfully, but these errors were encountered: