Skip to content

Commit a80495b

Browse files
committed
Fixed percent fraction extension and test
1 parent d7d20d3 commit a80495b

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

src/ExCSS/Extensions/ValueExtensions.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,15 @@ public static Length ToLength(this FontSize fontSize)
102102
return percent;
103103
}
104104

105-
var element = enumerable.OnlyOrDefault();
106-
107-
if (element is not { Type: TokenType.Percentage })
105+
var element = value.OnlyOrDefault();
106+
if (element is not NumberToken token)
108107
{
109108
return null;
110109
}
111110

112-
var number = ((NumberToken)element).Value;
113-
114111
try
115112
{
113+
var number = token.Value;
116114
var percentage = number / 100;
117115
return new Percent(percentage);
118116
}

0 commit comments

Comments
 (0)