/// <summary> /// 元素后贴 /// </summary> /// <param name="node"></param> protected void NodeAfter(IHtmlNode node) { node.Parent.Children().Remove(node); var nodes = _Parent.Children(); var index = nodes.IndexOf(this); node.Parent = _Parent; nodes.Insert(index + 1, node); }
/// <summary> /// 是否有子节点 /// </summary> /// <param name="source"></param> /// <returns></returns> public static bool HasChild(this IHtmlNode source) { if (source == null) { return(false); } return(source.Children().Count > 0); }
/// <summary> /// 创建节点 /// </summary> public HtmlNode() { _Parent = new EmptyNode(); Nodes = new List <IHtmlNode>(); _Parent.Children().Add(this); }