File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ let uniq = require('../utils').uniq
55let escapeRegexp = require ( '../utils' ) . escapeRegexp
66let splitSelector = require ( '../utils' ) . splitSelector
77
8+ const GAP_PROPS = / ^ ( g r i d - ) ? ( ( r o w | c o l u m n ) - ) ? g a p $ /
9+
810function convert ( value ) {
911 if (
1012 value &&
@@ -878,8 +880,7 @@ function getGridGap(decl) {
878880 let gap = { }
879881
880882 // try to find gap
881- let testGap = / ^ ( g r i d - ) ? ( ( r o w | c o l u m n ) - ) ? g a p $ /
882- decl . parent . walkDecls ( testGap , ( { prop, value } ) => {
883+ decl . parent . walkDecls ( GAP_PROPS , ( { prop, value } ) => {
883884 if ( / ^ ( g r i d - ) ? g a p $ / . test ( prop ) ) {
884885 let [ row , , column ] = parser ( value ) . nodes
885886
@@ -1014,8 +1015,8 @@ function inheritGridGap(decl, gap) {
10141015 return false
10151016 }
10161017
1017- // find grid- gap values
1018- r . walkDecls ( 'grid-gap' , d => ( gridGap = getGridGap ( d ) ) )
1018+ // find gap values, set either by the shorthand or by the longhands
1019+ r . walkDecls ( GAP_PROPS , d => ( gridGap = getGridGap ( d ) ) )
10191020
10201021 // skip rule without gaps
10211022 if ( ! gridGap || Object . keys ( gridGap ) . length === 0 ) {
Original file line number Diff line number Diff line change 301301 grid-template-rows : repeat (2 , 100px );
302302 }
303303}
304+
305+ .longhand-gap {
306+ display : grid;
307+ grid-column-gap : 50px ;
308+ grid-row-gap : 40px ;
309+ grid-template-areas :
310+ "p p"
311+ "q q" ;
312+ grid-template-columns : repeat (2 , 1fr );
313+ grid-template-rows : repeat (2 , 100px );
314+ }
315+
316+ /* must inherit gap from .longhand-gap */
317+ .longhand-gap .modifier {
318+ grid-template-areas :
319+ "p p"
320+ "q q" ;
321+ grid-template-columns : repeat (2 , 1fr );
322+ grid-template-rows : repeat (2 , 100px );
323+ }
Original file line number Diff line number Diff line change 435435 grid-template-rows : repeat (2 , 100px );
436436 }
437437}
438+
439+ .longhand-gap {
440+ display : -ms-grid;
441+ display : grid;
442+ grid-column-gap : 50px ;
443+ grid-row-gap : 40px ;
444+ grid-template-areas :
445+ "p p"
446+ "q q" ;
447+ -ms-grid-columns : 1fr 50px 1fr ;
448+ grid-template-columns : repeat (2 , 1fr );
449+ -ms-grid-rows : 100px 40px 100px ;
450+ grid-template-rows : repeat (2 , 100px );
451+ }
452+
453+ /* must inherit gap from .longhand-gap */
454+ .longhand-gap .modifier {
455+ grid-template-areas :
456+ "p p"
457+ "q q" ;
458+ -ms-grid-columns : 1fr 50px 1fr ;
459+ grid-template-columns : repeat (2 , 1fr );
460+ -ms-grid-rows : 100px 40px 100px ;
461+ grid-template-rows : repeat (2 , 100px );
462+ }
You can’t perform that action at this time.
0 commit comments