Create() public static method

Create an empty CQ object.
public static Create ( ) : CQ
return CQ
コード例 #1
0
ファイル: CQ.cs プロジェクト: asmboom/HtmlRenderer
        /// <summary>
        /// Runs a set of HTML creation selectors and returns result as a single enumerable.
        /// </summary>
        ///
        /// <param name="content">
        /// A sequence of strings that are each valid HTML
        /// </param>
        ///
        /// <returns>
        /// A new sequence containing all the elements from all the selectors.
        /// </returns>

        protected IEnumerable <IDomObject> MergeContent(IEnumerable <string> content)
        {
            List <IDomObject> allContent = new List <IDomObject>();

            foreach (var item in content)
            {
                allContent.AddRange(CQ.Create(item));
            }
            return(allContent);
        }
コード例 #2
0
        /// <summary>
        /// Select elements and return a new CSQuery object.
        /// </summary>
        ///
        /// <param name="selector">
        /// A string containing a selector expression.
        /// </param>
        ///
        /// <returns>
        /// A new CQ object.
        /// </returns>

        public CQ Select(string selector)
        {
            var sel = new Selector(selector);

            if (sel.IsHtml)
            {
                CQ csq = CQ.Create(selector);
                csq.CsQueryParent = this;
                return(csq);
            }
            else
            {
                return(Select(sel));
            }
        }
コード例 #3
0
 /// <summary>
 /// Creates a new DOM from a file
 /// </summary>
 /// <param name="htmlFile"></param>
 /// <returns></returns>
 public static CQ CreateFromFile(string htmlFile)
 {
     return(CQ.Create(Support.GetFile(htmlFile)));
 }
コード例 #4
0
ファイル: Create.cs プロジェクト: asmboom/HtmlRenderer
        /// <summary>
        /// Create a new CQ from an HTML fragment, and use quickSet to create attributes (and/or css)
        /// </summary>
        ///
        /// <param name="html">
        /// A string of HTML.
        /// </param>
        /// <param name="quickSet">
        /// an object containing CSS properties and attributes to be applied to the resulting fragment.
        /// </param>
        ///
        /// <returns>
        /// A new CQ object
        /// </returns>

        public static CQ Create(string html, object quickSet)
        {
            CQ csq = CQ.Create(html);

            return(csq.AttrSet(quickSet, true));
        }
コード例 #5
0
        public static CQ Create(string selector, object css)
        {
            CQ csq = CQ.Create(selector);

            return(csq.AttrSet(css, true));
        }