Fix grid gap inheritance from row-gap and column-gap longhands
This commit is contained in:
1 parent
9d01a08e29
commit
1b1d88a522
3 files changed
+50
-4
No files matched your search
@@ -5,6 +5,8 @@ let uniq = require('../utils').uniq
|
||||
let escapeRegexp = require('../utils').escapeRegexp
|
||||
let splitSelector = require('../utils').splitSelector
|
||||
|
||||
const GAP_PROPS = /^(grid-)?((row|column)-)?gap$/
|
||||
|
||||
function convert(value) {
|
||||
if (
|
||||
value &&
|
||||
@@ -878,8 +880,7 @@ function getGridGap(decl) {
|
||||
let gap = {}
|
||||
|
||||
// try to find gap
|
||||
let testGap = /^(grid-)?((row|column)-)?gap$/
|
||||
decl.parent.walkDecls(testGap, ({ prop, value }) => {
|
||||
decl.parent.walkDecls(GAP_PROPS, ({ prop, value }) => {
|
||||
if (/^(grid-)?gap$/.test(prop)) {
|
||||
let [row, , column] = parser(value).nodes
|
||||
|
||||
@@ -1014,8 +1015,8 @@ function inheritGridGap(decl, gap) {
|
||||
return false
|
||||
}
|
||||
|
||||
// find grid-gap values
|
||||
r.walkDecls('grid-gap', d => (gridGap = getGridGap(d)))
|
||||
// find gap values, set either by the shorthand or by the longhands
|
||||
r.walkDecls(GAP_PROPS, d => (gridGap = getGridGap(d)))
|
||||
|
||||
// skip rule without gaps
|
||||
if (!gridGap || Object.keys(gridGap).length === 0) {
|
||||
|
||||
Reference in new issue
Block a user