HtmlParserExtensions
using AngleSharp.DOM;
using AngleSharp.DOM.Collections;
using System.Collections.Generic;
namespace AngleSharp.Parser.Html
{
internal static class HtmlParserExtensions
{
public static bool IsEqualTo(this AttrContainer sourceAttributes, AttrContainer targetAttributes)
{
if (sourceAttributes.Count == targetAttributes.Count) {
for (int i = 0; i < sourceAttributes.Count; i++) {
IAttr attr = sourceAttributes[i];
IAttr attr2 = targetAttributes[attr.Name];
if (attr2 == null || attr.Value != attr2.Value)
return false;
}
return true;
}
return false;
}
public static void AppendAttributes(this Element element, HtmlTagToken tag)
{
foreach (KeyValuePair<string, string> attribute in tag.Attributes) {
element.AddAttribute(attribute.Key, attribute.Value);
}
}
}
}