示例#1
0
        public void Insert(AdjacentPosition position, String html)
        {
            var useThis = position == AdjacentPosition.AfterBegin || position == AdjacentPosition.BeforeEnd;
            var context = useThis ? this : Parent as Element;

            if (context == null)
            {
                throw new DomException("The element has no parent.");
            }

            var nodes = new DocumentFragment(context, html);

            switch (position)
            {
            case AdjacentPosition.BeforeBegin:
                Parent.InsertBefore(nodes, this);
                break;

            case AdjacentPosition.AfterEnd:
                Parent.InsertChild(Parent.IndexOf(this) + 1, nodes);
                break;

            case AdjacentPosition.AfterBegin:
                InsertChild(0, nodes);
                break;

            case AdjacentPosition.BeforeEnd:
                AppendChild(nodes);
                break;
            }
        }
示例#2
0
        /// <summary>
        /// Inserts new HTML elements specified by the given HTML string at a
        /// position relative to the current element specified by the position.
        /// </summary>
        /// <param name="position">The relation to the current element.</param>
        /// <param name="html">The HTML code to generate elements for.</param>
        public void Insert(AdjacentPosition position, String html)
        {
            var useThis    = position == AdjacentPosition.BeforeBegin || position == AdjacentPosition.AfterEnd;
            var nodeParent = useThis ? this : Parent as Element;
            var nodes      = new DocumentFragment(nodeParent, html);

            switch (position)
            {
            case AdjacentPosition.BeforeBegin:
                Parent.InsertBefore(nodes, this);
                break;

            case AdjacentPosition.AfterEnd:
                Parent.InsertChild(Parent.IndexOf(this) + 1, nodes);
                break;

            case AdjacentPosition.AfterBegin:
                InsertChild(0, nodes);
                break;

            case AdjacentPosition.BeforeEnd:
                AppendChild(nodes);
                break;
            }
        }
示例#3
0
        public void insertAdjacentHTML(AdjacentPosition position, String html)
        {
            var nodeParent = position == AdjacentPosition.BeforeBegin || position == AdjacentPosition.AfterEnd ? this : _parent;
            var nodes      = new DocumentFragment(DocumentBuilder.HtmlFragment(html, nodeParent));

            switch (position)
            {
            case AdjacentPosition.BeforeBegin:
                ParentNode.InsertBefore(nodes, this);
                break;

            case AdjacentPosition.AfterEnd:
                ParentNode.InsertChild(ParentNode.IndexOf(this) + 1, nodes);
                break;

            case AdjacentPosition.AfterBegin:
                InsertChild(0, nodes);
                break;

            case AdjacentPosition.BeforeEnd:
                AppendChild(nodes);
                break;
            }
        }
 public void Insert(AdjacentPosition position, String html)
 {
 }
示例#5
0
        /// <summary>
        /// Inserts new HTML elements specified by the given HTML string at a
        /// position relative to the current element specified by the position.
        /// </summary>
        /// <param name="position">The relation to the current element.</param>
        /// <param name="html">The HTML code to generate elements for.</param>
        public void Insert(AdjacentPosition position, String html)
        {
            var useThis = position == AdjacentPosition.BeforeBegin || position == AdjacentPosition.AfterEnd;
            var nodeParent = useThis ? this : Parent as Element;
            var nodes = new DocumentFragment(nodeParent, html);

            switch (position)
            {
                case AdjacentPosition.BeforeBegin:
                    Parent.InsertBefore(nodes, this);
                    break;

                case AdjacentPosition.AfterEnd:
                    Parent.InsertChild(Parent.IndexOf(this) + 1, nodes);
                    break;

                case AdjacentPosition.AfterBegin:
                    InsertChild(0, nodes);
                    break;

                case AdjacentPosition.BeforeEnd:
                    AppendChild(nodes);
                    break;
            }
        }
示例#6
0
 public void Insert(AdjacentPosition position, string html)
 {
     throw new NotImplementedException();
 }
示例#7
0
 public void Insert(AdjacentPosition position, String html)
 {
 }
示例#8
0
 /// <summary>
 /// Specifies where in matching elements the new content should be inserted.
 /// </summary>
 /// <param name="position">A <see cref="AdjacentPosition"/> indicating where the new content should be inserted.</param>
 /// <returns>The current module instance.</returns>
 public InsertHtml AtPosition(AdjacentPosition position = AdjacentPosition.BeforeEnd)
 {
     _position = position;
     return(this);
 }