csslint: CSS Grid Layout - actual implementation
This commit is contained in:
parent
4ecb6e7bc2
commit
a7a589b785
|
@ -2696,7 +2696,7 @@ Parser.prototype = function() {
|
||||||
|
|
||||||
//see if there's a simple match
|
//see if there's a simple match
|
||||||
} else if (tokenStream.match([Tokens.NUMBER, Tokens.PERCENTAGE, Tokens.LENGTH,
|
} else if (tokenStream.match([Tokens.NUMBER, Tokens.PERCENTAGE, Tokens.LENGTH,
|
||||||
Tokens.ANGLE, Tokens.TIME,
|
Tokens.ANGLE, Tokens.TIME, Tokens.DIMENSION,
|
||||||
Tokens.FREQ, Tokens.STRING, Tokens.IDENT, Tokens.URI, Tokens.UNICODE_RANGE])) {
|
Tokens.FREQ, Tokens.STRING, Tokens.IDENT, Tokens.URI, Tokens.UNICODE_RANGE])) {
|
||||||
|
|
||||||
value = tokenStream.token().value;
|
value = tokenStream.token().value;
|
||||||
|
@ -3519,7 +3519,7 @@ var Properties = module.exports = {
|
||||||
"color-rendering" : "auto | optimizeSpeed | optimizeQuality",
|
"color-rendering" : "auto | optimizeSpeed | optimizeQuality",
|
||||||
"column-count" : "<integer> | auto", //https://www.w3.org/TR/css3-multicol/
|
"column-count" : "<integer> | auto", //https://www.w3.org/TR/css3-multicol/
|
||||||
"column-fill" : "auto | balance",
|
"column-fill" : "auto | balance",
|
||||||
"column-gap" : "normal | <length> | <percentage>",
|
"column-gap" : "<column-gap>",
|
||||||
"column-rule" : "<border-width> || <border-style> || <color>",
|
"column-rule" : "<border-width> || <border-style> || <color>",
|
||||||
"column-rule-color" : "<color>",
|
"column-rule-color" : "<color>",
|
||||||
"column-rule-style" : "<border-style>",
|
"column-rule-style" : "<border-style>",
|
||||||
|
@ -3559,21 +3559,21 @@ var Properties = module.exports = {
|
||||||
"filter" : "<filter-function-list> | none",
|
"filter" : "<filter-function-list> | none",
|
||||||
"fit" : "fill | hidden | meet | slice",
|
"fit" : "fill | hidden | meet | slice",
|
||||||
"fit-position" : 1,
|
"fit-position" : 1,
|
||||||
"flex" : "<flex>",
|
"flex" : "<flex-shorthand>",
|
||||||
"flex-basis" : "<width>",
|
"flex-basis" : "<width>",
|
||||||
"flex-direction" : "row | row-reverse | column | column-reverse",
|
"flex-direction" : "row | row-reverse | column | column-reverse",
|
||||||
"flex-flow" : "<flex-direction> || <flex-wrap>",
|
"flex-flow" : "<flex-direction> || <flex-wrap>",
|
||||||
"flex-grow" : "<number>",
|
"flex-grow" : "<number>",
|
||||||
"flex-shrink" : "<number>",
|
"flex-shrink" : "<number>",
|
||||||
"flex-wrap" : "nowrap | wrap | wrap-reverse",
|
"flex-wrap" : "nowrap | wrap | wrap-reverse",
|
||||||
"-webkit-flex" : "<flex>",
|
"-webkit-flex" : "<flex-shorthand>",
|
||||||
"-webkit-flex-basis" : "<width>",
|
"-webkit-flex-basis" : "<width>",
|
||||||
"-webkit-flex-direction" : "row | row-reverse | column | column-reverse",
|
"-webkit-flex-direction" : "row | row-reverse | column | column-reverse",
|
||||||
"-webkit-flex-flow" : "<flex-direction> || <flex-wrap>",
|
"-webkit-flex-flow" : "<flex-direction> || <flex-wrap>",
|
||||||
"-webkit-flex-grow" : "<number>",
|
"-webkit-flex-grow" : "<number>",
|
||||||
"-webkit-flex-shrink" : "<number>",
|
"-webkit-flex-shrink" : "<number>",
|
||||||
"-webkit-flex-wrap" : "nowrap | wrap | wrap-reverse",
|
"-webkit-flex-wrap" : "nowrap | wrap | wrap-reverse",
|
||||||
"-ms-flex" : "<flex>",
|
"-ms-flex" : "<flex-shorthand>",
|
||||||
"-ms-flex-align" : "start | end | center | stretch | baseline",
|
"-ms-flex-align" : "start | end | center | stretch | baseline",
|
||||||
"-ms-flex-direction" : "row | row-reverse | column | column-reverse",
|
"-ms-flex-direction" : "row | row-reverse | column | column-reverse",
|
||||||
"-ms-flex-order" : "<number>",
|
"-ms-flex-order" : "<number>",
|
||||||
|
@ -3601,36 +3601,28 @@ var Properties = module.exports = {
|
||||||
"font-weight" : "<font-weight>",
|
"font-weight" : "<font-weight>",
|
||||||
|
|
||||||
//G
|
//G
|
||||||
"gap" : "[ <length> | normal ]{1,2}",
|
"gap" : "<row-gap> <column-gap>?",
|
||||||
"glyph-orientation-horizontal" : "<glyph-angle>",
|
"glyph-orientation-horizontal" : "<glyph-angle>",
|
||||||
"glyph-orientation-vertical" : "auto | <glyph-angle>",
|
"glyph-orientation-vertical" : "auto | <glyph-angle>",
|
||||||
"grid" : "<grid-template> | <grid-template-rows> / [ auto-flow && dense? ] <grid-auto-columns>? | [ auto-flow && dense? ] <grid-auto-rows>? / <grid-template-columns>",
|
"grid" : "<grid-template> | <grid-template-rows> / [ auto-flow && dense? ] <grid-auto-columns>? | [ auto-flow && dense? ] <grid-auto-rows>? / <grid-template-columns>",
|
||||||
"grid-area" : "<grid-line> [ / <grid-line> ]{0,3}",
|
"grid-area" : "<grid-line> [ / <grid-line> ]{0,3}",
|
||||||
"grid-auto-columns" : "<track-size>+",
|
"grid-auto-columns" : "<grid-auto-columns>",
|
||||||
"grid-auto-flow" : "[ row | column ] || dense",
|
"grid-auto-flow" : "[ row | column ] || dense",
|
||||||
"grid-auto-position" : 1,
|
"grid-auto-rows" : "<grid-auto-rows>",
|
||||||
"grid-auto-rows" : "<track-size>+",
|
|
||||||
"grid-cell-stacking" : "columns | rows | layer",
|
|
||||||
"grid-column" : "<grid-line> [ / <grid-line> ]?",
|
"grid-column" : "<grid-line> [ / <grid-line> ]?",
|
||||||
"grid-columns" : 1,
|
|
||||||
"grid-column-align" : "start | end | center | stretch",
|
|
||||||
"grid-column-sizing" : 1,
|
|
||||||
"grid-column-start" : "<grid-line>",
|
"grid-column-start" : "<grid-line>",
|
||||||
"grid-column-end" : "<grid-line>",
|
"grid-column-end" : "<grid-line>",
|
||||||
"grid-column-span" : "<integer>",
|
|
||||||
"grid-flow" : "none | rows | columns",
|
|
||||||
"grid-layer" : "<integer>",
|
|
||||||
"grid-row" : "<grid-line> [ / <grid-line> ]?",
|
"grid-row" : "<grid-line> [ / <grid-line> ]?",
|
||||||
"grid-rows" : 1,
|
|
||||||
"grid-row-align" : "start | end | center | stretch",
|
|
||||||
"grid-row-start" : "<grid-line>",
|
"grid-row-start" : "<grid-line>",
|
||||||
"grid-row-end" : "<grid-line>",
|
"grid-row-end" : "<grid-line>",
|
||||||
"grid-row-span" : "<integer>",
|
|
||||||
"grid-row-sizing" : 1,
|
|
||||||
"grid-template" : "none | [ <grid-template-rows> / <grid-template-columns> ] | [ <line-names>? <string> <track-size>? <line-names>? ]+ [ / <explicit-track-list> ]?",
|
"grid-template" : "none | [ <grid-template-rows> / <grid-template-columns> ] | [ <line-names>? <string> <track-size>? <line-names>? ]+ [ / <explicit-track-list> ]?",
|
||||||
"grid-template-areas" : "none | <string>+",
|
"grid-template-areas" : "none | <string>+",
|
||||||
"grid-template-columns" : "none | <track-list> | <auto-track-list>",
|
"grid-template-columns" : "<grid-template-columns>",
|
||||||
"grid-template-rows" : "none | <track-list> | <auto-track-list>",
|
"grid-template-rows" : "<grid-template-rows>",
|
||||||
|
//G - deprecated aliases
|
||||||
|
"grid-row-gap" : "<row-gap>",
|
||||||
|
"grid-column-gap" : "<column-gap>",
|
||||||
|
"grid-gap" : "<row-gap> <column-gap>?",
|
||||||
|
|
||||||
//H
|
//H
|
||||||
"hanging-punctuation" : 1,
|
"hanging-punctuation" : 1,
|
||||||
|
@ -3766,7 +3758,7 @@ var Properties = module.exports = {
|
||||||
"right" : "<margin-width>",
|
"right" : "<margin-width>",
|
||||||
"rotation" : 1,
|
"rotation" : 1,
|
||||||
"rotation-point" : 1,
|
"rotation-point" : 1,
|
||||||
"row-gap" : "normal | <length> | <percentage>",
|
"row-gap" : "<row-gap>",
|
||||||
"ruby-align" : 1,
|
"ruby-align" : 1,
|
||||||
"ruby-overhang" : 1,
|
"ruby-overhang" : 1,
|
||||||
"ruby-position" : 1,
|
"ruby-position" : 1,
|
||||||
|
@ -4140,6 +4132,7 @@ function PropertyValuePart(text, line, col, optionalHint) {
|
||||||
case "vw":
|
case "vw":
|
||||||
case "vmax":
|
case "vmax":
|
||||||
case "vmin":
|
case "vmin":
|
||||||
|
case "fr":
|
||||||
this.type = "length";
|
this.type = "length";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -6191,6 +6184,10 @@ copy(ValidationTypes, {
|
||||||
"drop-shadow() | grayscale() | hue-rotate() | invert() | " +
|
"drop-shadow() | grayscale() | hue-rotate() | invert() | " +
|
||||||
"opacity() | saturate() | sepia()",
|
"opacity() | saturate() | sepia()",
|
||||||
|
|
||||||
|
"<flex>": function(part) {
|
||||||
|
return part.type === "function" || part.type === "grid" && part.value >= 0;
|
||||||
|
},
|
||||||
|
|
||||||
"<flex-basis>": "<width>",
|
"<flex-basis>": "<width>",
|
||||||
|
|
||||||
"<flex-direction>": "row | row-reverse | column | column-reverse",
|
"<flex-direction>": "row | row-reverse | column | column-reverse",
|
||||||
|
@ -6243,6 +6240,10 @@ copy(ValidationTypes, {
|
||||||
return part.type === "identifier" || part.wasIdent;
|
return part.type === "identifier" || part.wasIdent;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"<ident-not-span>": function(part) {
|
||||||
|
return (part.type === "identifier" || part.wasIdent) && !/^span$/i.test(part.value);
|
||||||
|
},
|
||||||
|
|
||||||
"<ident-not-generic-family>": function(part) {
|
"<ident-not-generic-family>": function(part) {
|
||||||
return this["<ident>"](part) && !this["<generic-family>"](part);
|
return this["<ident>"](part) && !this["<generic-family>"](part);
|
||||||
},
|
},
|
||||||
|
@ -6283,6 +6284,10 @@ copy(ValidationTypes, {
|
||||||
(String(part) === "0" || part.type === "function" || (part.value) >= 0);
|
(String(part) === "0" || part.type === "function" || (part.value) >= 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"<positive-integer>": function(part) {
|
||||||
|
return this["<number>"](part) && (part.type === "function" || part.value > 0);
|
||||||
|
},
|
||||||
|
|
||||||
"<number>": function(part) {
|
"<number>": function(part) {
|
||||||
return part.type === "number" || this["<integer>"](part);
|
return part.type === "number" || this["<integer>"](part);
|
||||||
},
|
},
|
||||||
|
@ -6392,7 +6397,7 @@ copy(ValidationTypes, {
|
||||||
"<filter-function-list>": "[ <filter-function> | <uri> ]+",
|
"<filter-function-list>": "[ <filter-function> | <uri> ]+",
|
||||||
|
|
||||||
// https://www.w3.org/TR/2014/WD-css-flexbox-1-20140325/#flex-property
|
// https://www.w3.org/TR/2014/WD-css-flexbox-1-20140325/#flex-property
|
||||||
"<flex>":
|
"<flex-shorthand>":
|
||||||
"none | [ <flex-grow> <flex-shrink>? || <flex-basis> ]",
|
"none | [ <flex-grow> <flex-shrink>? || <flex-basis> ]",
|
||||||
|
|
||||||
"<font-family>": "[ <generic-family> | <family-name> ]#",
|
"<font-family>": "[ <generic-family> | <family-name> ]#",
|
||||||
|
@ -6443,6 +6448,28 @@ copy(ValidationTypes, {
|
||||||
"[ full-width | proportional-width ] || " +
|
"[ full-width | proportional-width ] || " +
|
||||||
"ruby",
|
"ruby",
|
||||||
|
|
||||||
|
"<grid-auto-columns>": "<track-size>+",
|
||||||
|
"<grid-auto-rows>": "<track-size>+",
|
||||||
|
"<grid-template>": "none | [ <grid-template-rows> / <grid-template-columns> ] | [ <line-names>? <string> <track-size>? <line-names>? ]+ [ / <explicit-track-list> ]?",
|
||||||
|
"<grid-template-columns>": "none | <track-list> | <auto-track-list>",
|
||||||
|
"<grid-template-rows>": "<grid-template-columns>",
|
||||||
|
"<grid-line>": "auto | <ident-not-span> | [ <integer> && <ident-not-span>? ] | [ span && [ <integer> || <ident-not-span> ] ]",
|
||||||
|
"<auto-repeat>": "repeat( [ auto-fill | auto-fit ] , [ <line-names>? <fixed-size> ]+ <line-names>? )",
|
||||||
|
"<auto-track-list>": "[ <line-names>? [ <fixed-size> | <fixed-repeat> ] ]* <line-names>? <auto-repeat> [ <line-names>? [ <fixed-size> | <fixed-repeat> ] ]* <line-names>?",
|
||||||
|
"<explicit-track-list>": "[ <line-names>? <track-size> ]+ <line-names>?",
|
||||||
|
"<fixed-breadth>": "<length-percentage>",
|
||||||
|
"<fixed-repeat>": "repeat( [ <positive-integer> ] , [ <line-names>? <fixed-size> ]+ <line-names>? )",
|
||||||
|
"<fixed-size>": "<fixed-breadth> | minmax( <fixed-breadth> , <track-breadth> ) | minmax( <inflexible-breadth> , <fixed-breadth> )",
|
||||||
|
"<inflexible-breadth>": "<length-percentage> | min-content | max-content | auto",
|
||||||
|
"<length-percentage>": "<length> | <percentage>",
|
||||||
|
"<line-names>": "[ <ident-not-span>* ]",
|
||||||
|
"<track-breadth>": "<length-percentage> | <flex> | min-content | max-content | auto",
|
||||||
|
"<track-list>": "[ <line-names>? [ <track-size> | <track-repeat> ] ]+ <line-names>?",
|
||||||
|
"<track-repeat>": "repeat( [ <positive-integer> ] , [ <line-names>? <track-size> ]+ <line-names>? )",
|
||||||
|
"<track-size>": "<track-breadth> | minmax( <inflexible-breadth> , <track-breadth> ) | fit-content( <length-percentage> )",
|
||||||
|
"<column-gap>": "normal | <length> | <percentage>",
|
||||||
|
"<row-gap>": "<column-gap>",
|
||||||
|
|
||||||
"<justify-content>":
|
"<justify-content>":
|
||||||
"normal | <content-distribution> | <overflow-position>? [ <content-position> | left | right ]",
|
"normal | <content-distribution> | <overflow-position>? [ <content-position> | left | right ]",
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user