private void _CQ(string selector, CQ context) { CsQueryParent = context; if (!String.IsNullOrEmpty(selector)) { Selector = new Selector(selector); SetSelection(Selector.Select(Document, context), Selector.IsHmtl ? SelectionSetOrder.OrderAdded : SelectionSetOrder.Ascending); } }
/// <summary> /// Select elements from within a context. /// </summary> /// /// <param name="selector"> /// A string containing a selector expression. /// </param> /// <param name="context"> /// The point in the document at which the selector should begin matching; similar to the context /// argument of the CQ.Create(selector, context) method. /// </param> /// /// <returns> /// A new CQ object. /// </returns> /// /// <url> /// http://api.jquery.com/jQuery/#jQuery1 /// </url> public CQ Select(string selector, IDomObject context) { var selectors = new Selector(selector); var selection = selectors.Select(Document, context); CQ csq = NewInstance(selection, this); csq.Selector = selectors; return csq; }
/// <summary> /// Select elements from within a context. /// </summary> /// /// <param name="selector"> /// A string containing a selector expression. /// </param> /// <param name="context"> /// The points in the document at which the selector should begin matching; similar to the /// context argument of the CQ.Create(selector, context) method. Only elements found below the /// members of the sequence in the document can be matched. /// </param> /// /// <returns> /// A new CQ object. /// </returns> /// /// <url> /// http://api.jquery.com/jQuery/#jQuery1 /// </url> public CQ Select(string selector, IEnumerable<IDomObject> context) { var selectors = new Selector(selector).ToContextSelector(); IEnumerable<IDomObject> selection = selectors.Select(Document, context); CQ csq = NewInstance(selection, (CQ)this); csq.Selector = selectors; return csq; }
private CQ FindImpl(Selector selector) { CQ csq = NewCqInDomain(); csq.AddSelection(selector.Select(Document, this)); csq.Selector = selector; return csq; }