|
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
|
| Rev | Line | |
|---|
| [9af201e] | 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | var parsers = require('../parsers');
|
|---|
| 4 | var implicitSetter = require('../parsers').implicitSetter;
|
|---|
| 5 |
|
|---|
| 6 | // the valid border-widths:
|
|---|
| 7 | var widths = ['thin', 'medium', 'thick'];
|
|---|
| 8 |
|
|---|
| 9 | module.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 | };
|
|---|
| 26 | var isValid = module.exports.isValid;
|
|---|
| 27 |
|
|---|
| 28 | var 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 |
|
|---|
| 39 | module.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.