Skip to content

Commit 1acc2a5

Browse files
authored
Merge pull request #57 from mganss/devel
Parse numerical font-weight in font shorthand
2 parents 496da0b + e6fe86d commit 1acc2a5

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/AngleSharp.Css.Tests/Declarations/CssFontProperty.cs

+12
Original file line numberDiff line numberDiff line change
@@ -677,5 +677,17 @@ public void CssFontStyleWeightSizeHeightFamiliesLegal()
677677
Assert.IsTrue(property.HasValue);
678678
Assert.AreEqual("italic bold 12px / 30px Georgia, serif", property.Value);
679679
}
680+
681+
[Test]
682+
public void CssFontStyleNumericWeightSizeFamiliesLegal()
683+
{
684+
var snippet = "font: 400 12px Georgia, serif";
685+
var property = ParseDeclaration(snippet);
686+
Assert.AreEqual("font", property.Name);
687+
Assert.IsFalse(property.IsImportant);
688+
Assert.IsFalse(property.IsInherited);
689+
Assert.IsTrue(property.HasValue);
690+
Assert.AreEqual("400 12px Georgia, serif", property.Value);
691+
}
680692
}
681693
}

src/AngleSharp.Css/Declarations/FontDeclaration.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public ICssValue Convert(StringSource source)
6060

6161
if (weight == null)
6262
{
63-
weight = source.ParseConstant(Map.FontWeights);
63+
weight = FontWeightDeclaration.Converter.Convert(source);
6464
source.SkipSpacesAndComments();
6565
}
6666

0 commit comments

Comments
 (0)