source: node_modules/autoprefixer/lib/hacks/grid-row-column.js@ 2058e5c

Last change on this file since 2058e5c was 2058e5c, checked in by istevanoska <ilinastevanoska@…>, 6 months ago

Working / before login

  • Property mode set to 100644
File size: 825 bytes
Line 
1let Declaration = require('../declaration')
2let utils = require('./grid-utils')
3
4class GridRowColumn extends Declaration {
5 /**
6 * Translate grid-row / grid-column to separate -ms- prefixed properties
7 */
8 insert(decl, prefix, prefixes) {
9 if (prefix !== '-ms-') return super.insert(decl, prefix, prefixes)
10
11 let values = utils.parse(decl)
12 let [start, span] = utils.translate(values, 0, 1)
13
14 let hasStartValueSpan = values[0] && values[0].includes('span')
15
16 if (hasStartValueSpan) {
17 span = values[0].join('').replace(/\D/g, '')
18 }
19
20 ;[
21 [decl.prop, start],
22 [`${decl.prop}-span`, span]
23 ].forEach(([prop, value]) => {
24 utils.insertDecl(decl, prop, value)
25 })
26
27 return undefined
28 }
29}
30
31GridRowColumn.names = ['grid-row', 'grid-column']
32
33module.exports = GridRowColumn
Note: See TracBrowser for help on using the repository browser.