HTMLCollection
A collection of HTML nodes.
namespace AngleSharp.DOM.Collections
{
public class HTMLCollection : BaseCollection<Element>
{
public object this[string id] {
get {
return NamedItem(id);
}
}
public virtual object NamedItem(string id)
{
HTMLCollection hTMLCollection = new HTMLCollection();
for (int i = 0; i < _entries.Count; i++) {
if (_entries[i].Id == id)
hTMLCollection.Add(_entries[i]);
}
if (hTMLCollection.Length == 1)
return hTMLCollection[0];
if (hTMLCollection.Length != 0)
return hTMLCollection;
for (int j = 0; j < _entries.Count; j++) {
if (_entries[j].GetAttribute("name") == id)
hTMLCollection.Add(_entries[j]);
}
if (hTMLCollection.Length == 1)
return hTMLCollection[0];
if (hTMLCollection.Length != 0)
return hTMLCollection;
return null;
}
}
}