source: node_modules/autoprefixer/lib/hacks/align-content.js@ 505f39a

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

Working / before login

  • Property mode set to 100644
File size: 1.0 KB
Line 
1let Declaration = require('../declaration')
2let flexSpec = require('./flex-spec')
3
4class AlignContent extends Declaration {
5 /**
6 * Return property name by final spec
7 */
8 normalize() {
9 return 'align-content'
10 }
11
12 /**
13 * Change property name for 2012 spec
14 */
15 prefixed(prop, prefix) {
16 let spec
17 ;[spec, prefix] = flexSpec(prefix)
18 if (spec === 2012) {
19 return prefix + 'flex-line-pack'
20 }
21 return super.prefixed(prop, prefix)
22 }
23
24 /**
25 * Change value for 2012 spec and ignore prefix for 2009
26 */
27 set(decl, prefix) {
28 let spec = flexSpec(prefix)[0]
29 if (spec === 2012) {
30 decl.value = AlignContent.oldValues[decl.value] || decl.value
31 return super.set(decl, prefix)
32 }
33 if (spec === 'final') {
34 return super.set(decl, prefix)
35 }
36 return undefined
37 }
38}
39
40AlignContent.names = ['align-content', 'flex-line-pack']
41
42AlignContent.oldValues = {
43 'flex-end': 'end',
44 'flex-start': 'start',
45 'space-around': 'distribute',
46 'space-between': 'justify'
47}
48
49module.exports = AlignContent
Note: See TracBrowser for help on using the repository browser.