You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Actually there is no way to get TokenSerializationType directly from Token type. If it is TokenSerializationTypeVariants::Nothing, it has nothing() function to get it.
Even parsing CSS that is hardcoded value such as 0px, to get type, we have to create Token object like the following.
let token =
Token::Dimension {
has_sign: false, value: 0.0, int_value: Some(0), unit: CowRcStr::from("px")
};
let token_type = token.serialization_type();
I am happy if cssparser has a function to get TokenSerializationType without creating object like TokenSerializationType::nothing().
The text was updated successfully, but these errors were encountered:
zrhoffman
added a commit
to zrhoffman/rust-cssparser
that referenced
this issue
Nov 9, 2023
Fixesservo#266
Making TokenSerializationType public is useful to describe the start and
end of a CSS string that is already known to be valid in cases when the
TokenSerializationTypes of the start and end of the CSS string is
needed, but Tokens are not.
This helps with creating a custom_properties::VariableValue from the CSS
string of a computed value for CSS Properties and Values, see Mozilla
bug 1858305 [1].
[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1858305
From https://bugzilla.mozilla.org/show_bug.cgi?id=1503656
Actually there is no way to get
TokenSerializationType
directly fromToken
type. If it isTokenSerializationTypeVariants::Nothing
, it hasnothing()
function to get it.Even parsing CSS that is hardcoded value such as
0px
, to get type, we have to create Token object like the following.I am happy if cssparser has a function to get
TokenSerializationType
without creating object likeTokenSerializationType::nothing()
.The text was updated successfully, but these errors were encountered: