Buckets:
| import parser from 'postcss-selector-parser' | |
| import { movePseudos } from './pseudoElements' | |
| export function applyImportantSelector(selector, important) { | |
| let sel = parser().astSync(selector) | |
| sel.each((sel) => { | |
| // For nesting, we only need to wrap a selector with :is() if it has a top-level combinator, | |
| // e.g. `.dark .text-white`, to be independent of DOM order. Any other selector, including | |
| // combinators inside of pseudos like `:where()`, are ok to nest. | |
| let shouldWrap = sel.nodes.some((node) => node.type === 'combinator') | |
| if (shouldWrap) { | |
| sel.nodes = [ | |
| parser.pseudo({ | |
| value: ':is', | |
| nodes: [sel.clone()], | |
| }), | |
| ] | |
| } | |
| movePseudos(sel) | |
| }) | |
| return `${important} ${sel.toString()}` | |
| } | |
Xet Storage Details
- Size:
- 774 Bytes
- Xet hash:
- ccb9da31466cb8c47ef47fe1674cdb1ef0015cf08f381eccb2cc70e9e15cb52c
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.