Don’t crash when important and parent selectors are equal in @apply (#12112)
* Don’t crash when important and parent selectors are equal in `@apply` * Update changelog
This commit is contained in:
parent
d32228628e
commit
457d2b1b1c
3 changed files with 60 additions and 0 deletions
|
|
@ -553,6 +553,13 @@ function processApply(root, context, localCache) {
|
|||
? parent.selector.slice(importantSelector.length)
|
||||
: parent.selector
|
||||
|
||||
// If the selector becomes empty after replacing the important selector
|
||||
// This means that it's the same as the parent selector and we don't want to replace it
|
||||
// Otherwise we'll crash
|
||||
if (parentSelector === '') {
|
||||
parentSelector = parent.selector
|
||||
}
|
||||
|
||||
rule.selector = replaceSelector(parentSelector, rule.selector, applyCandidate)
|
||||
|
||||
// And then re-add it if it was removed
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue