Skip to content

Commit d062955

Browse files
authored
fix: treat !important as case-insensitive (#152)
1 parent fed2c33 commit d062955

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

fixtures/ast/declaration/Important.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
},
1515
{
1616
"source": "property:!ImpoRtant",
17+
"generate": "property:!important",
1718
"ast": {
1819
"type": "Declaration",
19-
"important": "ImpoRtant",
20+
"important": true,
2021
"property": "property",
2122
"value": {
2223
"type": "Value",
@@ -26,9 +27,10 @@
2627
},
2728
{
2829
"source": "property:!IMPORTANT",
30+
"generate": "property:!important",
2931
"ast": {
3032
"type": "Declaration",
31-
"important": "IMPORTANT",
33+
"important": true,
3234
"property": "property",
3335
"value": {
3436
"type": "Value",

lib/syntax/node/Declaration.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,10 @@ function getImportant() {
157157
this.eat(Delim);
158158
this.skipSC();
159159

160+
const isImportant = this.cmpStr(this.tokenStart, this.tokenEnd, 'important');
160161
const important = this.consume(Ident);
161162

162-
// store original value in case it differ from `important`
163-
// for better original source restoring and hacks like `!ie` support
164-
return important === 'important' ? true : important;
163+
// Store non-standard values for better original source restoring and hacks
164+
// like `!ie` support.
165+
return isImportant ? true : important;
165166
}

0 commit comments

Comments
 (0)