Table of Contents

Class SelectorExtensions

Namespace
AngleSharp.Css.Dom
Assembly
AngleSharp.dll

A set of extension methods for selectors.

public static class SelectorExtensions
Inheritance
SelectorExtensions
Inherited Members

Methods

Match(ISelector, IElement)

Provides an alternate to Match(IElement, IElement?) that sets the scope to the owning document element (if there is one).

public static bool Match(this ISelector selector, IElement element)

Parameters

selector ISelector

The selector.

element IElement

The element to match against.

Returns

bool

The result of the match.

MatchAll(ISelector, IEnumerable<IElement>, IElement?)

Returns the elements within the given elements (using depth-first pre-order traversal) that match the selectors with the given scope.

public static IHtmlCollection<IElement> MatchAll(this ISelector selector, IEnumerable<IElement> elements, IElement? scope)

Parameters

selector ISelector

A selector object.

elements IEnumerable<IElement>

The elements to take as source.

scope IElement

The element to take as scope.

Returns

IHtmlCollection<IElement>

The collection containing the resulting elements.

MatchAny(ISelector, IEnumerable<IElement>, IElement?)

Returns the first element within the given elements (using depth-first pre-order traversal) that match the selectors with the given scope.

public static IElement? MatchAny(this ISelector selector, IEnumerable<IElement> elements, IElement? scope)

Parameters

selector ISelector

A selector object.

elements IEnumerable<IElement>

The elements to take as source.

scope IElement

The element to take as scope.

Returns

IElement

The resulting element or null.