Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use new applyImportantSelector
  • Loading branch information
RobinMalfait committed Mar 21, 2023
commit a844e6d7892bb6f55ca9697aeeca52693e4f3a60
3 changes: 2 additions & 1 deletion src/lib/expandApplyAtRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import parser from 'postcss-selector-parser'

import { resolveMatches } from './generateRules'
import escapeClassName from '../util/escapeClassName'
import { applyImportantSelector } from '../util/applyImportantSelector'

/** @typedef {Map<string, [any, import('postcss').Rule[]]>} ApplyCache */

Expand Down Expand Up @@ -555,7 +556,7 @@ function processApply(root, context, localCache) {

// And then re-add it if it was removed
if (importantSelector && parentSelector !== parent.selector) {
rule.selector = `${importantSelector} :is(${rule.selector})`
rule.selector = applyImportantSelector(rule.selector, importantSelector)
}

rule.walkDecls((d) => {
Expand Down
3 changes: 2 additions & 1 deletion src/lib/generateRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { isValidVariantFormatString, parseVariant } from './setupContextUtils'
import isValidArbitraryValue from '../util/isSyntacticallyValidPropertyValue'
import { splitAtTopLevelOnly } from '../util/splitAtTopLevelOnly.js'
import { flagEnabled } from '../featureFlags'
import { applyImportantSelector } from '../util/applyImportantSelector'

let classNameParser = selectorParser((selectors) => {
return selectors.first.filter(({ type }) => type === 'class').pop().value
Expand Down Expand Up @@ -868,7 +869,7 @@ function getImportantStrategy(important) {
}

rule.selectors = rule.selectors.map((selector) => {
return `${important} :is(${selector})`
return applyImportantSelector(selector, important)
})
}
}
Expand Down