source: frontend/node_modules/cssstyle/lib/properties/flex.js@ 9af201e

Last change on this file since 9af201e was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.2 KB
Line 
1'use strict';
2
3var shorthandParser = require('../parsers').shorthandParser;
4var shorthandSetter = require('../parsers').shorthandSetter;
5var shorthandGetter = require('../parsers').shorthandGetter;
6
7var shorthand_for = {
8 'flex-grow': require('./flexGrow'),
9 'flex-shrink': require('./flexShrink'),
10 'flex-basis': require('./flexBasis'),
11};
12
13var myShorthandSetter = shorthandSetter('flex', shorthand_for);
14
15module.exports.isValid = function isValid(v) {
16 return shorthandParser(v, shorthand_for) !== undefined;
17};
18
19module.exports.definition = {
20 set: function(v) {
21 var normalizedValue = String(v)
22 .trim()
23 .toLowerCase();
24
25 if (normalizedValue === 'none') {
26 myShorthandSetter.call(this, '0 0 auto');
27 return;
28 }
29 if (normalizedValue === 'initial') {
30 myShorthandSetter.call(this, '0 1 auto');
31 return;
32 }
33 if (normalizedValue === 'auto') {
34 this.removeProperty('flex-grow');
35 this.removeProperty('flex-shrink');
36 this.setProperty('flex-basis', normalizedValue);
37 return;
38 }
39
40 myShorthandSetter.call(this, v);
41 },
42 get: shorthandGetter('flex', shorthand_for),
43 enumerable: true,
44 configurable: true,
45};
Note: See TracBrowser for help on using the repository browser.