/// <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); }
/// <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)); } }
/// <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))); }
/// <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)); }
public static CQ Create(string selector, object css) { CQ csq = CQ.Create(selector); return(csq.AttrSet(css, true)); }