Exemplo n.º 1
0
        /// <summary>
        /// Set the HTML contents of each element in the set of matched elements. Any elements without
        /// InnerHtml are ignored.
        /// </summary>
        ///
        /// <param name="html">
        /// One or more strings of HTML markup.
        /// </param>
        ///
        /// <returns>
        /// The current CQ object.
        /// </returns>
        ///
        /// <url>
        /// http://api.jquery.com/html/#html2
        /// </url>

        public CQ Html(params string[] html)
        {
            CQ   htmlElements = EnsureCsQuery(MergeContent(html));
            bool first        = true;

            foreach (DomElement obj in OnlyElements(SelectionSet))
            {
                if (obj.InnerHtmlAllowed)
                {
                    obj.ChildNodes.Clear();
                    obj.ChildNodes.AddRange(first ? htmlElements : htmlElements.Clone());
                    first = false;
                }
            }
            return(this);
        }