Skip to content

Commit a2ef767

Browse files
author
Nicholas C. Zakas
committed
Fix erroneous missing standard border warning (fixes #7)
1 parent dd2ae0f commit a2ef767

File tree

8 files changed

+30
-20
lines changed

8 files changed

+30
-20
lines changed

build/csslint-node.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10329,7 +10329,7 @@ CSSLint.addRule({
1032910329
});
1033010330

1033110331
parser.addListener("property", function(event){
10332-
var name = event.property,
10332+
var name = event.property.text.toLowerCase(),
1033310333
parts = event.value.parts,
1033410334
i = 0,
1033510335
len = parts.length,
@@ -10367,11 +10367,11 @@ CSSLint.addRule({
1036710367
standard = needed;
1036810368
}
1036910369

10370-
if (!properties[needed]){
10370+
if (!properties[standard]){
1037110371
reporter.warn("Missing standard property '" + standard + "' to go along with '" + actual + "'.", event.selectors[0].line, event.selectors[0].col, rule);
1037210372
} else {
1037310373
//make sure standard property is last
10374-
if (properties[needed][0].pos < properties[actual][0].pos){
10374+
if (properties[standard][0].pos < properties[actual][0].pos){
1037510375
reporter.warn("Standard property '" + standard + "' should come after vendor-prefixed property '" + actual + "'.", event.selectors[0].line, event.selectors[0].col, rule);
1037610376
}
1037710377
}

build/csslint-rhino.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10330,7 +10330,7 @@ CSSLint.addRule({
1033010330
});
1033110331

1033210332
parser.addListener("property", function(event){
10333-
var name = event.property,
10333+
var name = event.property.text.toLowerCase(),
1033410334
parts = event.value.parts,
1033510335
i = 0,
1033610336
len = parts.length,
@@ -10368,11 +10368,11 @@ CSSLint.addRule({
1036810368
standard = needed;
1036910369
}
1037010370

10371-
if (!properties[needed]){
10371+
if (!properties[standard]){
1037210372
reporter.warn("Missing standard property '" + standard + "' to go along with '" + actual + "'.", event.selectors[0].line, event.selectors[0].col, rule);
1037310373
} else {
1037410374
//make sure standard property is last
10375-
if (properties[needed][0].pos < properties[actual][0].pos){
10375+
if (properties[standard][0].pos < properties[actual][0].pos){
1037610376
reporter.warn("Standard property '" + standard + "' should come after vendor-prefixed property '" + actual + "'.", event.selectors[0].line, event.selectors[0].col, rule);
1037710377
}
1037810378
}

build/csslint-tests.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,8 +807,13 @@ background: -ms-linear-gradient(top, #1e5799 ,#2989d8 ,#207cca ,#7db9e8 );
807807
Assert.areEqual(1, result.messages.length);
808808
Assert.areEqual("warning", result.messages[0].type);
809809
Assert.areEqual("Standard property 'border-radius' should come after vendor-prefixed property '-moz-border-radius'.", result.messages[0].message);
810+
},
811+
812+
"Using -moz-border-radius-bottomleft with border-bottom-left-radius should not result in a warning.": function(){
813+
var result = CSSLint.verify("h1 { -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }", { "vendor-prefix": 1 });
814+
Assert.areEqual(0, result.messages.length);
810815
}
811-
816+
812817
}));
813818

814819
})();

build/csslint-worker.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10329,7 +10329,7 @@ CSSLint.addRule({
1032910329
});
1033010330

1033110331
parser.addListener("property", function(event){
10332-
var name = event.property,
10332+
var name = event.property.text.toLowerCase(),
1033310333
parts = event.value.parts,
1033410334
i = 0,
1033510335
len = parts.length,
@@ -10367,11 +10367,11 @@ CSSLint.addRule({
1036710367
standard = needed;
1036810368
}
1036910369

10370-
if (!properties[needed]){
10370+
if (!properties[standard]){
1037110371
reporter.warn("Missing standard property '" + standard + "' to go along with '" + actual + "'.", event.selectors[0].line, event.selectors[0].col, rule);
1037210372
} else {
1037310373
//make sure standard property is last
10374-
if (properties[needed][0].pos < properties[actual][0].pos){
10374+
if (properties[standard][0].pos < properties[actual][0].pos){
1037510375
reporter.warn("Standard property '" + standard + "' should come after vendor-prefixed property '" + actual + "'.", event.selectors[0].line, event.selectors[0].col, rule);
1037610376
}
1037710377
}

build/csslint.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10330,7 +10330,7 @@ CSSLint.addRule({
1033010330
});
1033110331

1033210332
parser.addListener("property", function(event){
10333-
var name = event.property,
10333+
var name = event.property.text.toLowerCase(),
1033410334
parts = event.value.parts,
1033510335
i = 0,
1033610336
len = parts.length,
@@ -10368,11 +10368,11 @@ CSSLint.addRule({
1036810368
standard = needed;
1036910369
}
1037010370

10371-
if (!properties[needed]){
10371+
if (!properties[standard]){
1037210372
reporter.warn("Missing standard property '" + standard + "' to go along with '" + actual + "'.", event.selectors[0].line, event.selectors[0].col, rule);
1037310373
} else {
1037410374
//make sure standard property is last
10375-
if (properties[needed][0].pos < properties[actual][0].pos){
10375+
if (properties[standard][0].pos < properties[actual][0].pos){
1037610376
reporter.warn("Standard property '" + standard + "' should come after vendor-prefixed property '" + actual + "'.", event.selectors[0].line, event.selectors[0].col, rule);
1037710377
}
1037810378
}

build/npm/lib/csslint-node.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10329,7 +10329,7 @@ CSSLint.addRule({
1032910329
});
1033010330

1033110331
parser.addListener("property", function(event){
10332-
var name = event.property,
10332+
var name = event.property.text.toLowerCase(),
1033310333
parts = event.value.parts,
1033410334
i = 0,
1033510335
len = parts.length,
@@ -10367,11 +10367,11 @@ CSSLint.addRule({
1036710367
standard = needed;
1036810368
}
1036910369

10370-
if (!properties[needed]){
10370+
if (!properties[standard]){
1037110371
reporter.warn("Missing standard property '" + standard + "' to go along with '" + actual + "'.", event.selectors[0].line, event.selectors[0].col, rule);
1037210372
} else {
1037310373
//make sure standard property is last
10374-
if (properties[needed][0].pos < properties[actual][0].pos){
10374+
if (properties[standard][0].pos < properties[actual][0].pos){
1037510375
reporter.warn("Standard property '" + standard + "' should come after vendor-prefixed property '" + actual + "'.", event.selectors[0].line, event.selectors[0].col, rule);
1037610376
}
1037710377
}

src/rules/vendor-prefix.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ CSSLint.addRule({
2222
});
2323

2424
parser.addListener("property", function(event){
25-
var name = event.property,
25+
var name = event.property.text.toLowerCase(),
2626
parts = event.value.parts,
2727
i = 0,
2828
len = parts.length,
@@ -60,11 +60,11 @@ CSSLint.addRule({
6060
standard = needed;
6161
}
6262

63-
if (!properties[needed]){
63+
if (!properties[standard]){
6464
reporter.warn("Missing standard property '" + standard + "' to go along with '" + actual + "'.", event.selectors[0].line, event.selectors[0].col, rule);
6565
} else {
6666
//make sure standard property is last
67-
if (properties[needed][0].pos < properties[actual][0].pos){
67+
if (properties[standard][0].pos < properties[actual][0].pos){
6868
reporter.warn("Standard property '" + standard + "' should come after vendor-prefixed property '" + actual + "'.", event.selectors[0].line, event.selectors[0].col, rule);
6969
}
7070
}

tests/rules/vendor-prefix.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,13 @@
2626
Assert.areEqual(1, result.messages.length);
2727
Assert.areEqual("warning", result.messages[0].type);
2828
Assert.areEqual("Standard property 'border-radius' should come after vendor-prefixed property '-moz-border-radius'.", result.messages[0].message);
29+
},
30+
31+
"Using -moz-border-radius-bottomleft with border-bottom-left-radius should not result in a warning.": function(){
32+
var result = CSSLint.verify("h1 { -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }", { "vendor-prefix": 1 });
33+
Assert.areEqual(0, result.messages.length);
2934
}
30-
35+
3136
}));
3237

3338
})();

0 commit comments

Comments
 (0)