Files
react-native-devtools-frontend/node_modules/postcss-resolve-nested-selector
Nikolay Vitkov 2a1b3b34b1 Update StyleLint to v16
Stylelint v16 deprecated CJS so I moved our lint script to ESM,
and fixed all the deprecation warning.
The only place I needed to silence them were tests,
as we import CJS there.

Bug: none
Change-Id: Iae4d2df76c855a9738b774a2d035f22509770215
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6138610
Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
2025-01-03 02:57:06 -08:00
..
2025-01-03 02:57:06 -08:00
2025-01-03 02:57:06 -08:00
2025-01-03 02:57:06 -08:00
2025-01-03 02:57:06 -08:00
2025-01-03 02:57:06 -08:00

postcss-resolve-nested-selector

test

Given a (nested) selector in a PostCSS AST, return an array of resolved selectors.

Tested to work with the syntax of postcss-nested. Should also work with SCSS and Less syntax. If you'd like to help out by adding some automated tests for those, that'd be swell. In fact, if you'd like to add any automated tests, you are a winner!

If you want to resolve selectors in the same style as postcss-nesting you should instead use selector-resolve-nested

API

resolveNestedSelector(selector, node)

Returns an array of selectors resolved from selector.

For example, given this JS:

var resolvedNestedSelector = require('postcss-resolve-nested-selector');
postcssRoot.eachRule(function(rule) {
	rule.selectors.forEach(function(selector) {
		console.log(resolvedNestedSelector(selector, rule));
	});
});

And the following CSS:

.foo {
	.bar {
		color: pink;
	}
}

This should log:

['.foo']
['.foo .bar']

Or with this CSS:

.foo {
	.bar &,
	a {
		color: pink;
	}
}

This should log:

['.foo']
['.bar .foo']
['.foo a']