Пример #1
0
        /// <summary>
        /// Adds a child element at a specific index.
        /// </summary>
        ///
        /// <param name="index">
        /// The index at which to insert the element
        /// </param>
        /// <param name="item">
        /// The element to insert
        /// </param>

        public void Insert(int index, IDomObject item)
        {
            if (item.ParentNode != null)
            {
                item.Remove();
            }

            // This must come BEFORE AddParent - otherwise the index entry will be present already at this position

            ReindexFromRight(index);

            if (index == InnerList.Count)
            {
                InnerList.Add(item);
            }
            else
            {
                InnerList.Insert(index, item);
            }


            AddParent(item, index);

            RaiseChangedEvent(item);
        }
Пример #2
0
        /// <summary>
        /// Remove a tag from the document.
        /// </summary>
        /// <param name="tag">to be removed</param>
        private void RemoveTag(IDomObject tag)
        {
            var e = new RemovingTagEventArgs {
                Tag = tag
            };

            OnRemovingTag(e);
            if (!e.Cancel)
            {
                tag.Remove();
            }
        }
 private bool UpdateCssPath(bool foundFirstCss, IDomObject element)
 {
     if (foundFirstCss == false)
     {
         element.SetAttribute("href", Globals.FullPath(_styleBundle.Path));
     }
     else
     {
         element.Remove();
     }
     return(true);
 }
Пример #4
0
 /// <summary>
 /// Add a child to this element
 /// </summary>
 /// <param name="element"></param>
 public void Add(IDomObject item)
 {
     if (item.ParentNode != null)
     {
         item.Remove();
     }
     // Ensure ID uniqueness - remove ID if same-named object already exists
     if (!String.IsNullOrEmpty(item.Id) &&
         !Owner.IsDisconnected &&
         Owner.Document.GetElementById(item.Id) != null)
     {
         item.Id = null;
     }
     InnerList.Add(item);
     AddParent(item, InnerList.Count - 1);
 }
Пример #5
0
 /// <summary>
 /// Remove a tag from the document.
 /// </summary>
 /// <param name="tag">to be removed</param>
 private void RemoveTag(IDomObject tag)
 {
     var e = new RemovingTagEventArgs { Tag = tag };
     OnRemovingTag(e);
     if (!e.Cancel) tag.Remove();
 }
 private bool UpdateCssPath(bool foundFirstCss, IDomObject element)
 {
     if (foundFirstCss == false)
     {
         element.SetAttribute("href", Globals.FullPath(_styleBundle.Path));
     }
     else
     {
         element.Remove();
     }
     return true;
 }