source: node_modules/autoprefixer/lib/hacks/justify-content.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: 1.2 KB
Line 
1let Declaration = require('../declaration')
2let flexSpec = require('./flex-spec')
3
4class JustifyContent extends Declaration {
5 /**
6 * Return property name by final spec
7 */
8 normalize() {
9 return 'justify-content'
10 }
11
12 /**
13 * Change property name for 2009 and 2012 specs
14 */
15 prefixed(prop, prefix) {
16 let spec
17 ;[spec, prefix] = flexSpec(prefix)
18 if (spec === 2009) {
19 return prefix + 'box-pack'
20 }
21 if (spec === 2012) {
22 return prefix + 'flex-pack'
23 }
24 return super.prefixed(prop, prefix)
25 }
26
27 /**
28 * Change value for 2009 and 2012 specs
29 */
30 set(decl, prefix) {
31 let spec = flexSpec(prefix)[0]
32 if (spec === 2009 || spec === 2012) {
33 let value = JustifyContent.oldValues[decl.value] || decl.value
34 decl.value = value
35 if (spec !== 2009 || value !== 'distribute') {
36 return super.set(decl, prefix)
37 }
38 } else if (spec === 'final') {
39 return super.set(decl, prefix)
40 }
41 return undefined
42 }
43}
44
45JustifyContent.names = ['justify-content', 'flex-pack', 'box-pack']
46
47JustifyContent.oldValues = {
48 'flex-end': 'end',
49 'flex-start': 'start',
50 'space-around': 'distribute',
51 'space-between': 'justify'
52}
53
54module.exports = JustifyContent
Note: See TracBrowser for help on using the repository browser.