Skip to main content

is_time_token

Function is_time_token 

Source
pub(crate) fn is_time_token(low: &str) -> bool
Expand description

transition プロパティ(カンマ区切りの複数項目)をパース。 例: “width 1s ease, background-color 0.5s linear 0.2s”。 トークンが実際に時間値(<number>s / <number>ms)かどうかを判定する。 単に末尾が s かどうかだけを見ると flex-basis/border-radius のように 末尾がたまたま s で終わるプロパティ名まで時間値と誤認してしまう (font: oblique <angle>10deg を size と誤認したのと同根の「緩すぎる トークン分類」バグ)ため、単位を除いた残りが実際に数値としてパースできる ことまで確認する。