|
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:
904 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | var parsers = require('../parsers');
|
|---|
| 4 |
|
|---|
| 5 | // <length> <length>? | inherit
|
|---|
| 6 | // if one, it applies to both horizontal and verical spacing
|
|---|
| 7 | // if two, the first applies to the horizontal and the second applies to vertical spacing
|
|---|
| 8 |
|
|---|
| 9 | var parse = function parse(v) {
|
|---|
| 10 | if (v === '' || v === null) {
|
|---|
| 11 | return undefined;
|
|---|
| 12 | }
|
|---|
| 13 | if (v === 0) {
|
|---|
| 14 | return '0px';
|
|---|
| 15 | }
|
|---|
| 16 | if (v.toLowerCase() === 'inherit') {
|
|---|
| 17 | return v;
|
|---|
| 18 | }
|
|---|
| 19 | var parts = v.split(/\s+/);
|
|---|
| 20 | if (parts.length !== 1 && parts.length !== 2) {
|
|---|
| 21 | return undefined;
|
|---|
| 22 | }
|
|---|
| 23 | parts.forEach(function(part) {
|
|---|
| 24 | if (parsers.valueType(part) !== parsers.TYPES.LENGTH) {
|
|---|
| 25 | return undefined;
|
|---|
| 26 | }
|
|---|
| 27 | });
|
|---|
| 28 |
|
|---|
| 29 | return v;
|
|---|
| 30 | };
|
|---|
| 31 |
|
|---|
| 32 | module.exports.definition = {
|
|---|
| 33 | set: function(v) {
|
|---|
| 34 | this._setProperty('border-spacing', parse(v));
|
|---|
| 35 | },
|
|---|
| 36 | get: function() {
|
|---|
| 37 | return this.getPropertyValue('border-spacing');
|
|---|
| 38 | },
|
|---|
| 39 | enumerable: true,
|
|---|
| 40 | configurable: true,
|
|---|
| 41 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.