Handle duplicate atrules without children (#8122)
* Handle duplicate atrules without children We assumed that all At Rule nodes had children. Including ones that do not and should not — for example `@import url(…);`. Since this is not the case we’ll skip adding children for nodes that don’t have any. * Update changelog Co-authored-by: Jordi Marimon Palarea <jordimarimon7@gmail.com>
This commit is contained in:
parent
5c76de72ba
commit
e5ed08b5cb
3 changed files with 25 additions and 2 deletions
|
|
@ -29,7 +29,11 @@ export default function collapseAdjacentRules() {
|
|||
(currentRule[property] ?? '').replace(/\s+/g, ' ')
|
||||
)
|
||||
) {
|
||||
currentRule.append(node.nodes)
|
||||
// An AtRule may not have children (for example if we encounter duplicate @import url(…) rules)
|
||||
if (node.nodes) {
|
||||
currentRule.append(node.nodes)
|
||||
}
|
||||
|
||||
node.remove()
|
||||
} else {
|
||||
currentRule = node
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue