Skip to content

Commit 95e5d18

Browse files
committed
Ensure 0s, 0ms don't say to omit the units (fixes #224)
1 parent 85fef33 commit 95e5d18

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/rules/zero-units.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ CSSLint.addRule({
2121
len = parts.length;
2222

2323
while(i < len){
24-
if ((parts[i].units || parts[i].type == "percentage") && parts[i].value === 0){
24+
if ((parts[i].units || parts[i].type == "percentage") && parts[i].value === 0 && parts[i].type != "time"){
2525
reporter.report("Values of 0 shouldn't have units specified.", parts[i].line, parts[i].col, rule);
2626
}
2727
i++;

tests/rules/zero-units.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,14 @@
3131
"Using 0 should not result in a warning": function(){
3232
var result = CSSLint.verify("h1 { left: 0; }", { "zero-units": 1 });
3333
Assert.areEqual(0, result.messages.length);
34+
},
35+
36+
"Using 0s for animation-duration should not result in a warning": function(){
37+
var result = CSSLint.verify("h1 { animation-duration: 0s; }", { "zero-units": 1 });
38+
Assert.areEqual(0, result.messages.length);
3439
}
40+
41+
3542
}));
3643

3744
})();

0 commit comments

Comments
 (0)