CssTransitionDelayProperty
More information available at:
https://developer.mozilla.org/en-US/docs/CSS/transition-delay
using AngleSharp.Css;
using AngleSharp.Extensions;
using System.Collections.Generic;
namespace AngleSharp.Dom.Css
{
internal sealed class CssTransitionDelayProperty : CssProperty, ICssTransitionDelayProperty, ICssProperty
{
internal static readonly IValueConverter<Time> SingleConverter = Converters.TimeConverter;
internal static readonly IValueConverter<Time[]> Converter = SingleConverter.FromList();
internal static readonly Time Default = Time.Zero;
private readonly List<Time> _times;
public IEnumerable<Time> Delays => _times;
internal CssTransitionDelayProperty(CssStyleDeclaration rule)
: base(PropertyNames.TransitionDelay, rule, PropertyFlags.None)
{
_times = new List<Time>();
Reset();
}
public void SetDelays(IEnumerable<Time> times)
{
_times.Clear();
_times.AddRange(times);
}
internal override void Reset()
{
_times.Clear();
_times.Add(Default);
}
protected override bool IsValid(ICssValue value)
{
return Converter.TryConvert(value, SetDelays);
}
}
}