/// <summary> /// 内部方法,添加表单域元素 /// </summary> /// <param name="e"></param> internal void AppendElement(IHTMLFormElement e) { if (!myElements.Contains((HTMLElement)e)) { myElements.Add(( HTMLElement )e); e.Form = this; } }
internal virtual void InnerGetAllElement(HTMLElementList list) { foreach (HTMLElement element in myChildNodes) { list.Add(element); if (element is HTMLContainer) { (( HTMLContainer )element).InnerGetAllElement(list); } } }
/// <summary> /// 添加子标签对象 /// </summary> /// <param name="e">对象</param> /// <returns>操作是否成功</returns> public override bool AppendChild(HTMLElement e) { if (e.TagName == StringConstTagName.Tr || e.TagName == StringConstTagName.TBody) { myChildNodes.Add(e); } else { myCols.Add(e); } e.Parent = this; e.OwnerDocument = myOwnerDocument; return(true); }
/// <summary> /// 获得所有指定名称的元素 /// </summary> /// <param name="vName">名称</param> /// <param name="myList">保存获得到元素的列表</param> /// <returns>获得到元素的个数</returns> internal virtual int InnerGetElementsByName(string vName, HTMLElementList myList) { int iCount = 0; foreach (HTMLElement e in myChildNodes) { if (e.GetAttribute(StringConstAttributeName.Name) == vName) { myList.Add(e); iCount++; } if (e is HTMLContainer) { iCount += (( HTMLContainer)e).InnerGetElementsByName(vName, myList); } } return(iCount); }
/// <summary> /// 获得所有指定标签名称的元素 /// </summary> /// <param name="vTagName">指定的标签名称</param> /// <param name="myList">保存获得到元素的列表</param> /// <returns>获得到元素的个数</returns> internal virtual int InnerGetElementsByTagName(string vTagName, HTMLElementList myList) { int iCount = 0; foreach (HTMLElement e in myChildNodes) { if (e.TagName == vTagName) { myList.Add(e); iCount++; } if (e is HTMLContainer) { iCount += (( HTMLContainer)e).InnerGetElementsByTagName(vTagName, myList); } } return(iCount); }
/// <summary> /// 内部的添加子元素 /// </summary> /// <param name="e"></param> /// <returns></returns> internal bool InnerAppendChild(HTMLElement e) { if (this.CheckChildTagName(e.TagName) && e.CheckParent(this)) { myChildNodes.Add(e); e.Parent = this; e.OwnerDocument = myOwnerDocument; if (e is IHTMLFormElement) { HTMLElement frm = this; while ((frm != null) && (!(frm is HTMLFormElement))) { frm = frm.Parent; } if (frm is HTMLFormElement) { (( HTMLFormElement )frm).AppendElement(( IHTMLFormElement)e); } } return(true); } return(false); }