SetParent() private method

private SetParent ( DomNode parentNode ) : void
parentNode DomNode
return void
Exemplo n.º 1
0
        public virtual bool RemoveChild(DomNode childNode)
        {
            switch (childNode.NodeKind)
            {
            case HtmlNodeKind.Attribute:
            {
                //TODO: support remove attribute
                return(false);
            }

            default:
            {
                if (_myChildrenNodes != null)
                {
                    bool result = _myChildrenNodes.Remove(childNode);
                    if (result)
                    {
                        childNode.SetParent(null);
                        NotifyChange(ElementChangeKind.RemoveChild, null);
                    }
                    return(result);
                }
                return(false);
            }
            }
        }
Exemplo n.º 2
0
        public virtual void AddChild(DomNode childNode)
        {
#if DEBUG
            if (childNode.ParentNode != null)
            {
                throw new System.NotSupportedException();
            }
#endif
            switch (childNode.NodeKind)
            {
            case HtmlNodeKind.Attribute:
            {
                SetAttribute((DomAttribute)childNode);
            }
            break;

            default:
            {
                if (_myChildrenNodes == null)
                {
                    _myChildrenNodes = new List <DomNode>();
                }
                _myChildrenNodes.Add((DomNode)childNode);
                childNode.SetParent(this);
                NotifyChange(ElementChangeKind.AddChild, null);
            }
            break;
            }
        }
Exemplo n.º 3
0
        public virtual void AddChild(DomNode childNode)
        {
            switch (childNode.NodeType)
            {
            case HtmlNodeType.Attribute:
            {
                AddAttribute((DomAttribute)childNode);
            } break;

            default:
            {
                if (myChildrenNodes == null)
                {
                    myChildrenNodes = new List <DomNode>();
                }
                myChildrenNodes.Add((DomNode)childNode);
                childNode.SetParent(this);

                NotifyChange(ElementChangeKind.AddChild);
            } break;
            }
        }
Exemplo n.º 4
0
 public virtual bool RemoveChild(DomNode childNode)
 {
     switch (childNode.NodeType)
     {
         case HtmlNodeType.Attribute:
             {
                 //TODO: support remove attribute
                 return false;
             }
         default:
             {
                 if (myChildrenNodes != null)
                 {
                     bool result = myChildrenNodes.Remove(childNode);
                     if (result)
                     {
                         childNode.SetParent(null);
                         NotifyChange(ElementChangeKind.RemoveChild);
                     }
                     return result;
                 }
                 return false;
             }
     }
 }
Exemplo n.º 5
0
 public virtual void AddChild(DomNode childNode)
 {
     switch (childNode.NodeType)
     {
         case HtmlNodeType.Attribute:
             {
                 AddAttribute((DomAttribute)childNode);
             }
             break;
         default:
             {
                 if (myChildrenNodes == null)
                 {
                     myChildrenNodes = new List<DomNode>();
                 }
                 myChildrenNodes.Add((DomNode)childNode);
                 childNode.SetParent(this);
                 NotifyChange(ElementChangeKind.AddChild);
             }
             break;
     }
 }