# HtmlCssSelector

A parsed selector that can match the owned DOM without a selector provider.

Class 

`OfficeIMO.Html.Css`

**Namespace**

`OfficeIMO.Html.Css`

**Assembly**

`OfficeIMO.Html.Core`

**Source revision**

`56dd0d38e0b5` with working tree changes

**Source**

[HtmlCssSelectorContracts.cs:92](https://github.com/EvotecIT/OfficeIMO/blob/56dd0d38e0b526611c1af001c026f8c72600880f/OfficeIMO.Html.Core/Css/HtmlCssSelectorContracts.cs#L92)

**Modifiers**

sealed

A parsed selector that can match the owned DOM without a selector provider.

## Inheritance

- object
- HtmlCssSelector

## Usage

Explore 2 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

### Returned or exposed by 2

- Property [HtmlCssSelectorList.Selectors](/api/html-core/officeimo-html-css-htmlcssselectorlist/#property-selectors)
- Property [HtmlCssSelectorParseResult.Selector](/api/html-core/officeimo-html-css-htmlcssselectorparseresult/#property-selector)

Filter members 

Show inherited

## Methods

Matches 2 overloads

`public bool Matches(HtmlElement element)` [#](#method-matches-officeimo-html-dom-htmlelement)

[HtmlCssSelectorContracts.cs:92](https://github.com/EvotecIT/OfficeIMO/blob/56dd0d38e0b526611c1af001c026f8c72600880f/OfficeIMO.Html.Core/Css/HtmlCssSelectorContracts.cs#L92)

Matches an element using only owned DOM state.

Parameters

**element OfficeIMO.Html.Dom.HtmlElement required**

Returns

`bool`

`public bool Matches(HtmlElement element, CancellationToken cancellationToken)` [#](#method-matches-officeimo-html-dom-htmlelement-threading-cancellationtoken)

[HtmlCssSelectorContracts.cs:96](https://github.com/EvotecIT/OfficeIMO/blob/56dd0d38e0b526611c1af001c026f8c72600880f/OfficeIMO.Html.Core/Css/HtmlCssSelectorContracts.cs#L96)

Matches an element using only owned DOM state and observes cancellation while traversing the tree.

Parameters

**element OfficeIMO.Html.Dom.HtmlElement required**

**cancellationToken System.Threading.CancellationToken required**

Returns

`bool`

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

## Properties

`public string Source { get; }` [#](#property-source)

[HtmlCssSelectorContracts.cs:80](https://github.com/EvotecIT/OfficeIMO/blob/56dd0d38e0b526611c1af001c026f8c72600880f/OfficeIMO.Html.Core/Css/HtmlCssSelectorContracts.cs#L80)

The trimmed selector source.

`public HtmlCssSelectorSpecificity Specificity { get; }` [#](#property-specificity)

[HtmlCssSelectorContracts.cs:82](https://github.com/EvotecIT/OfficeIMO/blob/56dd0d38e0b526611c1af001c026f8c72600880f/OfficeIMO.Html.Core/Css/HtmlCssSelectorContracts.cs#L82)

The selector specificity computed from the parsed selector model.

`public int CompoundCount { get; }` [#](#property-compoundcount)

[HtmlCssSelectorContracts.cs:87](https://github.com/EvotecIT/OfficeIMO/blob/56dd0d38e0b526611c1af001c026f8c72600880f/OfficeIMO.Html.Core/Css/HtmlCssSelectorContracts.cs#L87)

Number of compound selectors in the complex selector.

`public IReadOnlyList<HtmlCssCombinator> Combinators { get; }` [#](#property-combinators)

[HtmlCssSelectorContracts.cs:89](https://github.com/EvotecIT/OfficeIMO/blob/56dd0d38e0b526611c1af001c026f8c72600880f/OfficeIMO.Html.Core/Css/HtmlCssSelectorContracts.cs#L89)

Combinators in left-to-right source order.

<!-- PowerForge markdown artifact sha256:2FFBE72B019F754E167B879F628D9162028D22BAA30153B807A3005C350CAF83 -->
