public DomObjectQuery Select(DomSelector selector) { if (selector == null) { throw new ArgumentNullException(nameof(selector)); } return(selector.Select(this)); }
public DomObjectQuery Closest(DomSelector selector) { if (selector == null) { throw new ArgumentNullException(nameof(selector)); } return(CreateNew(Nodes().Select(e => e.Closest(selector)).NonNull())); }
public DomContainer Closest(DomSelector selector) { if (selector == null) { throw new ArgumentNullException(nameof(selector)); } return((DomContainer)ContainerOrSelf.AncestorsAndSelf.FirstOrDefault(t => selector.Matches(t))); }
public DomContainer Closest(string selector) { DomSelector s; if (!DomSelector.TryParse(selector, out s)) { throw Failure.NotParsable(nameof(selector), typeof(DomSelector)); } return(Closest(s)); }
private static Exception _TryParse(string text, out DomSelector result) { result = null; if (CssSelector.TryParse(text, out CssSelector css)) { result = css; return(null); } return(Failure.NotParsable("text", typeof(DomSelector))); }
public DomElement QuerySelector(DomSelector selector) { return(_items.Select(t => t.QuerySelector(selector)).FirstOrDefault()); }
public DomElementQuery QuerySelectorAll(DomSelector selector) { return(CreateNew(_items.SelectMany(t => t.QuerySelectorAll(selector)))); }
public DomObjectQuery Select(DomSelector selector) { return(ProviderFactory.CreateObjectQuery( _items.SelectMany(n => n.Select(selector)) )); }
public DomElementQuery Closest(DomSelector selector) { return(Query(e => e.Closest(selector) as DomElement)); }
public DomElement QuerySelector(DomSelector selector) { return(QuerySelectorAll(selector).FirstOrDefault()); }
public DomElementQuery QuerySelectorAll(DomSelector selector) { return(Select(selector).Elements); }
DomNode IDomNodeQuery <DomNode> .Closest(DomSelector selector) { return(Closest(selector)); }
public static bool TryParse(string text, out DomSelector result) { return(_TryParse(text, out result) == null); }
public DomElementQuery QuerySelectorAll(DomSelector selector) { return(new DomElementQuery(Nodes().SelectMany(t => t.QuerySelectorAll(selector)))); }
public DomObjectQuery Select(DomSelector selector) { return(CreateNew( Nodes().SelectMany(n => n.Select(selector)) )); }
public DomObjectQuery Closest(string selector) { DomSelector s = ParseSelector(selector); return(Closest(s)); }