/// <summary> /// Check if one element is a descendant of another /// </summary> /// <param name="parent"> /// The ancestor element /// </param> /// <param name="child"> /// The child element in question /// </param> /// <returns> /// True if child is a descendant of parent, false otherwise /// </returns> public static bool IsDescendantOf(DomNode parent, DomNode child) { while (!CUIUtility.IsNullOrUndefined(child)) { try { if (child.NodeName.ToLower() == "body") { break; } } catch { // Firefox will sometimes start trying to iterate its own chrome nodes such as // the scrollbar which causes an access denied exception. If we get here, there's // nothing we can do, so just check the condition and break out of the loop if (child == parent) return true; break; } if (child == parent) return true; child = child.ParentNode; } return false; }
extern public void AppendChild(DomNode newChild);
/// <summary> /// Removes all the child nodes from a DOMElement the slow way. /// Don't use this unless you have to (see remarks) /// </summary> /// <param name="elm">A pointer to the node to remove children from</param> /// <remarks> /// This method should only be used when we can't replace elm in the DOM tree. /// If you don't need this guarantee, please use RemoveChildNodes(DOMElement elm) instead. /// </remarks> /// <owner alias="JKern" /> public static void RemoveChildNodesSlow(DomNode elm) { while (elm.HasChildNodes()) { elm.RemoveChild(elm.FirstChild); } }
extern public DomNode SwapNode(DomNode otherNode);
extern public DomNode ReplaceNode(DomNode replacement);
extern public DomNode RemoveChild(DomNode oldChild);
extern public DomNode ReplaceChild(DomNode newChild, DomNode oldChild);
extern public void Add(DomNode child);
extern public DomNode InsertBefore(DomNode newChild, DomNode child);
extern public DomNode ReplaceNode(DomNode replacement);
extern public void AppendChild(DomNode newChild);
extern public DomNode SwapNode(DomNode otherNode);
extern public DomNode ReplaceChild(DomNode newChild, DomNode oldChild);
extern public DomNode RemoveChild(DomNode oldChild);
extern public DomNode InsertBefore(DomNode newChild, DomNode child);
extern public void Add(DomNode child);