Skip to content

Commit 9a29ab4

Browse files
committed
Merge pull request #115 from malept/css3-sizing
Add support for the CSS3 sizing spec
2 parents 638e4cb + 88d01d7 commit 9a29ab4

3 files changed

Lines changed: 16 additions & 7 deletions

File tree

src/css/Properties.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ var Properties = {
333333

334334
//H
335335
"hanging-punctuation" : 1,
336-
"height" : "<margin-width> | inherit",
336+
"height" : "<margin-width> | <content-sizing> | inherit",
337337
"hyphenate-after" : "<integer> | auto",
338338
"hyphenate-before" : "<integer> | auto",
339339
"hyphenate-character" : "<string> | auto",
@@ -380,10 +380,10 @@ var Properties = {
380380
"marquee-play-count" : 1,
381381
"marquee-speed" : 1,
382382
"marquee-style" : 1,
383-
"max-height" : "<length> | <percentage> | none | inherit",
384-
"max-width" : "<length> | <percentage> | none | inherit",
385-
"min-height" : "<length> | <percentage> | inherit",
386-
"min-width" : "<length> | <percentage> | inherit",
383+
"max-height" : "<length> | <percentage> | <content-sizing> | none | inherit",
384+
"max-width" : "<length> | <percentage> | <content-sizing> | none | inherit",
385+
"min-height" : "<length> | <percentage> | <content-sizing> | contain-floats | -moz-contain-floats | -webkit-contain-floats | inherit",
386+
"min-width" : "<length> | <percentage> | <content-sizing> | contain-floats | -moz-contain-floats | -webkit-contain-floats | inherit",
387387
"move-to" : 1,
388388

389389
//N
@@ -516,7 +516,7 @@ var Properties = {
516516
"white-space" : "normal | pre | nowrap | pre-wrap | pre-line | inherit | -pre-wrap | -o-pre-wrap | -moz-pre-wrap | -hp-pre-wrap", //http://perishablepress.com/wrapping-content/
517517
"white-space-collapse" : 1,
518518
"widows" : "<integer> | inherit",
519-
"width" : "<length> | <percentage> | auto | inherit" ,
519+
"width" : "<length> | <percentage> | <content-sizing> | auto | inherit",
520520
"word-break" : "normal | keep-all | break-all",
521521
"word-spacing" : "<length> | normal | inherit",
522522
"word-wrap" : "normal | break-word",

src/css/ValidationTypes.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ var ValidationTypes = {
168168
return ValidationTypes.isLiteral(part, "none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset");
169169
},
170170

171+
"<content-sizing>": function(part){ // http://www.w3.org/TR/css3-sizing/#width-height-keywords
172+
return ValidationTypes.isLiteral(part, "fill-available | -moz-available | -webkit-fill-available | max-content | -moz-max-content | -webkit-max-content | min-content | -moz-min-content | -webkit-min-content | fit-content | -moz-fit-content | -webkit-fit-content");
173+
},
174+
171175
"<margin-width>": function(part){
172176
return this["<length>"](part) || this["<percentage>"](part) || ValidationTypes.isLiteral(part, "auto");
173177
},

tests/css/Validation.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,11 +633,16 @@
633633
"calc(100% + 1em)",
634634
"calc(100%/6)",
635635
"calc(10%*6)",
636+
"min-content",
637+
"-moz-fit-content",
638+
"-moz-available",
639+
"-webkit-fill-available",
640+
"contain-floats",
636641
"inherit"
637642
],
638643

639644
invalid: {
640-
"foo" : "Expected (<length> | <percentage> | inherit) but found 'foo'."
645+
"foo" : "Expected (<length> | <percentage> | <content-sizing> | contain-floats | -moz-contain-floats | -webkit-contain-floats | inherit) but found 'foo'."
641646
}
642647
}));
643648

0 commit comments

Comments
 (0)