| 1 |
let Declaration = require('../declaration') |
| 2 |
let utils = require('./grid-utils') |
| 3 |
|
| 4 |
class PlaceSelf extends Declaration { |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
insert(decl, prefix, prefixes) { |
| 9 |
if (prefix !== '-ms-') return super.insert(decl, prefix, prefixes) |
| 10 |
|
| 11 |
|
| 12 |
if (decl.parent.some(i => i.prop === '-ms-grid-row-align')) { |
| 13 |
return undefined |
| 14 |
} |
| 15 |
|
| 16 |
let [[first, second]] = utils.parse(decl) |
| 17 |
|
| 18 |
if (second) { |
| 19 |
utils.insertDecl(decl, 'grid-row-align', first) |
| 20 |
utils.insertDecl(decl, 'grid-column-align', second) |
| 21 |
} else { |
| 22 |
utils.insertDecl(decl, 'grid-row-align', first) |
| 23 |
utils.insertDecl(decl, 'grid-column-align', first) |
| 24 |
} |
| 25 |
|
| 26 |
return undefined |
| 27 |
} |
| 28 |
} |
| 29 |
|
| 30 |
PlaceSelf.names = ['place-self'] |
| 31 |
|
| 32 |
module.exports = PlaceSelf |