source: frontend/node_modules/cssstyle/lib/properties/borderWidth.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: 950 bytes
Line 
1'use strict';
2
3var parsers = require('../parsers');
4var implicitSetter = require('../parsers').implicitSetter;
5
6// the valid border-widths:
7var widths = ['thin', 'medium', 'thick'];
8
9module.exports.isValid = function parse(v) {
10 var length = parsers.parseLength(v);
11 if (length !== undefined) {
12 return true;
13 }
14 if (typeof v !== 'string') {
15 return false;
16 }
17 if (v === '') {
18 return true;
19 }
20 v = v.toLowerCase();
21 if (widths.indexOf(v) === -1) {
22 return false;
23 }
24 return true;
25};
26var isValid = module.exports.isValid;
27
28var parser = function(v) {
29 var length = parsers.parseLength(v);
30 if (length !== undefined) {
31 return length;
32 }
33 if (isValid(v)) {
34 return v.toLowerCase();
35 }
36 return undefined;
37};
38
39module.exports.definition = {
40 set: implicitSetter('border', 'width', isValid, parser),
41 get: function() {
42 return this.getPropertyValue('border-width');
43 },
44 enumerable: true,
45 configurable: true,
46};
Note: See TracBrowser for help on using the repository browser.