Skip to content

Conversation

@elchininet
Copy link
Owner

This pull request fixes a bug when the same declaration property is declared multiple times in a rule.

Input

.test {
    color: red;
    text-align: left;
    text-align: center;
}

Output Before

.test {
    color: red;
    text-align: center;
}

[dir="ltr"] .test {
    text-align: left;
}

[dir="rtl"] .test {
    text-align: right;
}

In the original CSS file the text-align: center is overriding the text-align: left but in the output, the opposite occurs due to a higher specificity of the [dir="ltr"] and [dir="rtl"] rules.

Output After the Fix

.test {
    color: red;
}

[dir="ltr"] .test {
    text-align: left;
}

[dir="rtl"] .test {
    text-align: right;
}

[dir] .test {
    text-align: center;
}

The bothPrefix property has been used to create a rule and maintain the same input behavior.

@elchininet elchininet added the bug Something isn't working label May 3, 2021
@elchininet elchininet self-assigned this May 3, 2021
@elchininet elchininet merged commit 529c4f5 into master May 3, 2021
@elchininet elchininet deleted the fix_multiple_declarations_overriding_order branch May 3, 2021 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants