---
url: /reference/@cssdoc/cssdoc/functions/selectorDefines.md
---
# Function: selectorDefines()

```ts
function selectorDefines(selectorText, selector): boolean;
```

Defined in: [packages/providers/src/aspects.ts:80](https://github.com/thedannywahl/cssdoc/blob/main/packages/providers/src/aspects.ts#L80)

Whether `selectorText` (the record's concatenated selectors) defines the modifier/part `selector`.

When `selector` starts with `.` the check is class-aware: literal class token match, then `class`
attribute selectors evaluated with their CSS operator semantics (`*=` substring, `$=` suffix,
`~=`/`=` exact word; `^=` is intentionally excluded as it anchors to the base class).

For any other prefix (`[`, `#`, `:`, or a plain type selector) the check is a direct substring
search — `selectorText.includes(selector)`. This handles attribute selectors (`[data-layout="x"]`),
IDs (`#foo`), and `:host` without modifications.

## Parameters

### selectorText

`string`

### selector

`string`

## Returns

`boolean`
