source: frontend/node_modules/cssstyle/lib/properties/padding.js

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

Fix frontend appearance

  • Property mode set to 100644
File size: 1.1 KB
Line 
1'use strict';
2
3var parsers = require('../parsers.js');
4var TYPES = parsers.TYPES;
5
6var isValid = function(v) {
7 var type = parsers.valueType(v);
8 return (
9 type === TYPES.LENGTH ||
10 type === TYPES.PERCENT ||
11 (type === TYPES.INTEGER && (v === '0' || v === 0))
12 );
13};
14
15var parser = function(v) {
16 return parsers.parseMeasurement(v);
17};
18
19var mySetter = parsers.implicitSetter('padding', '', isValid, parser);
20var myGlobal = parsers.implicitSetter(
21 'padding',
22 '',
23 function() {
24 return true;
25 },
26 function(v) {
27 return v;
28 }
29);
30
31module.exports.definition = {
32 set: function(v) {
33 if (typeof v === 'number') {
34 v = String(v);
35 }
36 if (typeof v !== 'string') {
37 return;
38 }
39 var V = v.toLowerCase();
40 switch (V) {
41 case 'inherit':
42 case 'initial':
43 case 'unset':
44 case '':
45 myGlobal.call(this, V);
46 break;
47
48 default:
49 mySetter.call(this, v);
50 break;
51 }
52 },
53 get: function() {
54 return this.getPropertyValue('padding');
55 },
56 enumerable: true,
57 configurable: true,
58};
59
60module.exports.isValid = isValid;
61module.exports.parser = parser;
Note: See TracBrowser for help on using the repository browser.