Skip to content

Commit 99a8233

Browse files
committed
Allow calculated values for padding.
This is a follow up to 17a2f01, which began to enforce the non-negative value restriction on <padding-width>.
1 parent 69bfd59 commit 99a8233

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/css/ValidationTypes.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ var ValidationTypes = {
181181
},
182182

183183
"<padding-width>": function(part){
184-
return part.value >= 0 && (this["<length>"](part) || this["<percentage>"](part));
184+
return (this["<length>"](part) || this["<percentage>"](part)) &&
185+
(String(part) === "0" || part.type === "function" || (part.value) >= 0);
185186
},
186187

187188
"<shape>": function(part){

tests/css/Validation.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,8 +1202,11 @@
12021202
property: "padding-left",
12031203

12041204
valid: [
1205+
"0",
12051206
"6px",
12061207
"3%",
1208+
"1em",
1209+
"calc(100% - 80px)",
12071210
"inherit"
12081211
],
12091212

0 commit comments

Comments
 (0)