AttrExtensions
Extensions for the list of attributes.
using System;
using System.Runtime.CompilerServices;
namespace AngleSharp.Dom
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public static class AttrExtensions
{
public static bool SameAs(this INamedNodeMap sourceAttributes, INamedNodeMap targetAttributes)
{
if (sourceAttributes.Length == targetAttributes.Length) {
foreach (IAttr sourceAttribute in sourceAttributes) {
bool flag = false;
foreach (IAttr targetAttribute in targetAttributes) {
flag = (sourceAttribute.GetHashCode() == targetAttribute.GetHashCode());
if (flag)
break;
}
if (!flag)
return false;
}
return true;
}
return false;
}
public static INamedNodeMap Clear(this INamedNodeMap attributes)
{
if (attributes == null)
throw new ArgumentNullException("attributes");
while (attributes.Length > 0) {
string name = attributes[attributes.Length - 1].Name;
attributes.RemoveNamedItem(name);
}
return attributes;
}
}
}