AngleSharp by Florian Rappl

<PackageReference Include="AngleSharp" Version="0.8.2" />

.NET API 1,168,384 bytes

 CssBorderWidthProperty

More information available at: https://developer.mozilla.org/en-US/docs/Web/CSS/border-width
using AngleSharp.Css; using AngleSharp.Extensions; using System; using System.Collections.Generic; using System.Linq; namespace AngleSharp.Dom.Css { internal sealed class CssBorderWidthProperty : CssShorthandProperty { private static readonly IValueConverter<Tuple<ICssValue, ICssValue, ICssValue, ICssValue>> Converter = Converters.LineWidthConverter.Val().Periodic(); internal CssBorderWidthProperty(CssStyleDeclaration rule) : base(PropertyNames.BorderWidth, rule, PropertyFlags.Animatable) { } protected override bool IsValid(ICssValue value) { return Converter.TryConvert(value, delegate(Tuple<ICssValue, ICssValue, ICssValue, ICssValue> m) { Get<CssBorderTopWidthProperty>().TrySetValue(m.Item1); Get<CssBorderRightWidthProperty>().TrySetValue(m.Item2); Get<CssBorderBottomWidthProperty>().TrySetValue(m.Item3); Get<CssBorderLeftWidthProperty>().TrySetValue(m.Item4); }); } internal override string SerializeValue(IEnumerable<CssProperty> properties) { CssBorderTopWidthProperty cssBorderTopWidthProperty = properties.OfType<CssBorderTopWidthProperty>().FirstOrDefault(); CssBorderRightWidthProperty cssBorderRightWidthProperty = properties.OfType<CssBorderRightWidthProperty>().FirstOrDefault(); CssBorderBottomWidthProperty cssBorderBottomWidthProperty = properties.OfType<CssBorderBottomWidthProperty>().FirstOrDefault(); CssBorderLeftWidthProperty cssBorderLeftWidthProperty = properties.OfType<CssBorderLeftWidthProperty>().FirstOrDefault(); if (cssBorderTopWidthProperty == null || cssBorderRightWidthProperty == null || cssBorderBottomWidthProperty == null || cssBorderLeftWidthProperty == null) return string.Empty; if (!cssBorderTopWidthProperty.HasValue || !cssBorderRightWidthProperty.HasValue || !cssBorderBottomWidthProperty.HasValue || !cssBorderLeftWidthProperty.HasValue) return string.Empty; return CssShorthandProperty.SerializePeriodic(cssBorderTopWidthProperty, cssBorderRightWidthProperty, cssBorderBottomWidthProperty, cssBorderLeftWidthProperty); } } }