/// <summary> /// Get the descendants elements of the element with a selector /// </summary> public static IEnumerable <HElement> Find(this HContainer element, String selector) { if (element != null) { return(element.Descendants(selector)); } return(Enumerable.Empty <HElement>()); }
/// <summary> /// Get the children elements of the element with a selector /// </summary> public static IEnumerable <HElement> Children(this HContainer element, String selector) { if (element != null) { return(element.Elements(selector)); } return(Enumerable.Empty <HElement>()); }
/// <summary> /// Reduce the set of matched elements /// </summary> public static IEnumerable <HElement> Filter(this HContainer element, Func <int, HElement, bool> selection) { if (element != null) { return(element.Descendants().Filter(selection)); } return(Enumerable.Empty <HElement>()); }
/// <summary> /// Remove elements from the set of elements /// </summary> public static IEnumerable <HElement> Not(this HContainer element, IEnumerable <HElement> selection) { if (element != null) { return(element.Descendants().Not(selection)); } return(Enumerable.Empty <HElement>()); }
/// <summary> /// Enumerate all parents /// </summary> protected IEnumerable <HElement> GetParents(String name) { HContainer p = parent; while (p != null) { HElement e = p as HElement; if (e != null && (name == null || String.Equals(e.Name, name, StringComparison.OrdinalIgnoreCase))) { yield return(e); } p = p.parent; } }
internal HContainer(HContainer other) { if (other.content is string) { this.content = other.content; } else { HNode n = (HNode)other.content; if (n != null) { do { n = n.nextNode; AppendNode(n.CloneNode()); } while (n != other.content); } } }