Beispiel #1
0
 /// <summary>
 /// Raises the <see cref="E:RemovingTag" /> event.
 /// </summary>
 /// <param name="e">The <see cref="RemovingTagEventArgs"/> instance containing the event data.</param>
 protected virtual void OnRemovingTag(RemovingTagEventArgs e)
 {
     if (RemovingTag != null)
     {
         RemovingTag(this, e);
     }
 }
Beispiel #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();
            }
        }
Beispiel #3
0
        /// <summary>
        /// Removes a tag from the document.
        /// </summary>
        /// <param name="tag">Tag to be removed</param>
        /// <param name="reason">Reason for removal</param>
        private void RemoveTag(IElement tag, RemoveReason reason)
        {
            var e = new RemovingTagEventArgs {
                Tag = tag, Reason = reason
            };

            OnRemovingTag(e);
            if (!e.Cancel)
            {
                tag.Remove();
            }
        }
Beispiel #4
0
        /// <summary>
        /// Removes a tag from the document.
        /// </summary>
        /// <param name="tag">Tag to be removed</param>
        /// <param name="reason">Reason for removal</param>
        private void RemoveTag(IElement tag, RemoveReason reason)
        {
            var e = new RemovingTagEventArgs {
                Tag = tag, Reason = reason
            };

            OnRemovingTag(e);
            if (!e.Cancel)
            {
                if (KeepChildNodes && tag.HasChildNodes)
                {
                    tag.Replace(tag.ChildNodes.ToArray());
                }
                else
                {
                    tag.Remove();
                }
            }
        }
Beispiel #5
0
 /// <summary>
 /// Raises the <see cref="E:RemovingTag" /> event.
 /// </summary>
 /// <param name="e">The <see cref="RemovingTagEventArgs"/> instance containing the event data.</param>
 protected virtual void OnRemovingTag(RemovingTagEventArgs e)
 {
     RemovingTag?.Invoke(this, e);
 }
 /// <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();
 }
 /// <summary>
 /// Raises the <see cref="E:RemovingTag" /> event.
 /// </summary>
 /// <param name="e">The <see cref="RemovingTagEventArgs"/> instance containing the event data.</param>
 protected virtual void OnRemovingTag(RemovingTagEventArgs e)
 {
     if (RemovingTag != null) RemovingTag(this, e);
 }
 /// <summary>
 /// Remove a tag from the document.
 /// </summary>
 /// <param name="tag">to be removed</param>
 /// <param name="reason">reason why to be removed</param>
 private void RemoveTag(IElement tag, RemoveReason reason)
 {
     var e = new RemovingTagEventArgs { Tag = tag, Reason = reason };
     OnRemovingTag(e);
     if (!e.Cancel) tag.Remove();
 }