Skip to content

Commit 20e0f21

Browse files
committed
Merge branch 'master' of github.com:stubbornella/csslint
2 parents 7195850 + d3ece60 commit 20e0f21

9 files changed

+873
-54
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ CSSLint is a tool to help point out problems with your CSS code. It does basic s
2525
1. Cillian de Róiste, https://plus.google.com/116480676247600483573/posts (Node CLI fixes)
2626
1. Damien Sennm, https://github.com/topaxi (README fixes)
2727
1. Jonathan Barnett, http://twitter.com/indieisaconcept (JUnit formatter)
28-
1. Zach Leatherman, http://www.zachleat.com/ (bug fixes)
28+
1. Zach Leatherman, http://www.zachleat.com/ (bug fixes)
29+
1. Philip Walton, http://philipwalton.com (Rules fixes, bug fixes)

src/rules/compatible-vendor-prefixes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ CSSLint.addRule({
4242
"border-end-style" : "webkit moz",
4343
"border-end-width" : "webkit moz",
4444
"border-image" : "webkit moz o",
45-
"border-radius" : "webkit moz",
45+
"border-radius" : "webkit",
4646
"border-start" : "webkit moz",
4747
"border-start-color" : "webkit moz",
4848
"border-start-style" : "webkit moz",

src/rules/fallback-colors.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,17 @@ CSSLint.addRule({
1515
propertiesToCheck = {
1616
color: 1,
1717
background: 1,
18-
"background-color": 1
18+
"border-color": 1,
19+
"border-top-color": 1,
20+
"border-right-color": 1,
21+
"border-bottom-color": 1,
22+
"border-left-color": 1,
23+
border: 1,
24+
"border-top": 1,
25+
"border-right": 1,
26+
"border-bottom": 1,
27+
"border-left": 1,
28+
"background-color": 1
1929
},
2030
properties;
2131

src/rules/selector-max-approaching.js

+12-14
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,23 @@ CSSLint.addRule({
66

77
//rule information
88
id: "selector-max-approaching",
9-
name: "Warn when approaching the 4095 limit for IE",
10-
desc: "Will warn when selector count is >= 3800 rules.",
9+
name: "Warn when approaching the 4095 selector limit for IE",
10+
desc: "Will warn when selector count is >= 3800 selectors.",
1111
browsers: "IE",
1212

1313
//initialization
14-
init: function(parser, reporter){
15-
var rule = this,
16-
count = 0;
14+
init: function(parser, reporter) {
15+
var rule = this, count = 0;
1716

18-
parser.addListener('startrule',function(event){
19-
count++;
20-
21-
});
17+
parser.addListener('startrule', function(event) {
18+
count += event.selectors.length;
19+
});
2220

23-
parser.addListener("endstylesheet", function(){
24-
if(count >= 3800){
25-
reporter.report("You have "+count+" rules. Internet Explorer supports a maximum of 4095 rules. Consider refactoring.",0,0,rule);
26-
}
21+
parser.addListener("endstylesheet", function() {
22+
if (count >= 3800) {
23+
reporter.report("You have " + count + " selectors. Internet Explorer supports a maximum of 4095 selectors per stylesheet. Consider refactoring.",0,0,rule);
24+
}
2725
});
28-
}
26+
}
2927

3028
});

src/rules/selector-max.js

+11-12
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,23 @@ CSSLint.addRule({
66

77
//rule information
88
id: "selector-max",
9-
name: "Error when past the 4095 limit for IE",
9+
name: "Error when past the 4095 selector limit for IE",
1010
desc: "Will error when selector count is > 4095.",
1111
browsers: "IE",
1212

1313
//initialization
1414
init: function(parser, reporter){
15-
var rule = this,
16-
count = 0;
15+
var rule = this, count = 0;
1716

18-
parser.addListener('startrule',function(event){
19-
count++;
20-
});
17+
parser.addListener('startrule',function(event) {
18+
count += event.selectors.length;
19+
});
2120

22-
parser.addListener("endstylesheet", function(){
23-
if(count>4095){
24-
reporter.report("You have "+count+" rules. Internet Explorer supports a maximum of 4095 rules. All additional rules will be ignored by IE. Consider refactoring.",0,0,rule);
25-
}
26-
});
27-
}
21+
parser.addListener("endstylesheet", function() {
22+
if (count > 4095) {
23+
reporter.report("You have " + count + " selectors. Internet Explorer supports a maximum of 4095 selectors per stylesheet. Consider refactoring.",0,0,rule);
24+
}
25+
});
26+
}
2827

2928
});

tests/rules/compatible-vendor-prefixes.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,9 @@
77

88
name: "Compatible Vendor Prefix Warnings",
99

10-
"Using -webkit-border-radius should warn to also include -moz-border-radius.": function(){
10+
"Using -webkit-border-radius should not warn to also include -moz-border-radius.": function(){
1111
var result = CSSLint.verify("h1 { -webkit-border-radius: 5px; }", { "compatible-vendor-prefixes": 1 });
12-
Assert.areEqual(1, result.messages.length);
13-
Assert.areEqual("warning", result.messages[0].type);
14-
Assert.areEqual("The property -moz-border-radius is compatible with -webkit-border-radius and should be included as well.", result.messages[0].message);
15-
Assert.areEqual(6, result.messages[0].col);
16-
Assert.areEqual(1, result.messages[0].line);
12+
Assert.areEqual(0, result.messages.length);
1713
},
1814

1915
"Using -webkit-transition and -moz-transition should warn to also include -o-transition.": function() {

0 commit comments

Comments
 (0)