<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@csstools/selector-resolve-nested](./selector-resolve-nested.md)

## selector-resolve-nested package

Resolve nested selectors following the CSS nesting specification.

## Example


```js
import { resolveNestedSelector } from '@csstools/selector-resolve-nested';
import parser from 'postcss-selector-parser';

const selector = parser().astSync('.foo &');
const parent = parser().astSync('.bar');

// .foo .bar
console.log(
  resolveNestedSelector(selector, parent).toString()
)
```

## Functions

<table><thead><tr><th>

Function


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[flattenNestedSelector(selector, parentSelector)](./selector-resolve-nested.flattennestedselector.md)


</td><td>

Flatten a nested selector against a given parent selector.

⚠️ This is not a method to generate the equivalent un-nested selector. It is purely a method to construct a single selector AST that contains the parts of both the current and parent selector. It will not have the correct specificity and it will not match the right elements when used as a selector. It will not always serialize to a valid selector.


</td></tr>
<tr><td>

[resolveNestedSelector(selector, parentSelector, options)](./selector-resolve-nested.resolvenestedselector.md)


</td><td>

Resolve a nested selector against a given parent selector.


</td></tr>
</tbody></table>

## Interfaces

<table><thead><tr><th>

Interface


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[ResolveOptions](./selector-resolve-nested.resolveoptions.md)


</td><td>


</td></tr>
</tbody></table>

