cssstyle 0.2.37 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -20
- package/lib/CSSStyleDeclaration.js +8 -8
- package/lib/parsers.js +1 -1
- package/lib/properties/alignContent.js +12 -0
- package/lib/properties/alignItems.js +12 -0
- package/lib/properties/borderSpacing.js +3 -0
- package/lib/properties/flexDirection.js +12 -0
- package/lib/properties/flexFlow.js +12 -0
- package/lib/properties/flexWrap.js +12 -0
- package/lib/properties/justifyContent.js +12 -0
- package/lib/properties/transform.js +12 -0
- package/lib/properties.js +94 -0
- package/lib/validProperties.js +410 -0
- package/package.json +14 -9
- package/scripts/generate_valid_properties.js +62 -0
- package/tests/tests.js +49 -4
- package/.npmignore +0 -1
- package/scripts/run_tests.sh +0 -4
package/README.md
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
CSSStyleDeclaration
|
|
2
|
-
|
|
1
|
+
# CSSStyleDeclaration
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/cssstyle)
|
|
3
4
|
|
|
4
5
|
CSSStyleDeclaration is a work-a-like to the CSSStyleDeclaration class in Nikita Vasilyev's [CSSOM](https://github.com/NV/CSSOM). I made it so that when using [jQuery in node](https://github.com/tmtk75/node-jquery) setting css attributes via $.fn.css() would work. node-jquery uses [jsdom](https://github.com/tmpvar/jsdom) to create a DOM to use in node. jsdom uses CSSOM for styling, and CSSOM's implementation of the [CSSStyleDeclaration](http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration) doesn't support [CSS2Properties](http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSS2Properties), which is how jQuery's [$.fn.css()](http://api.jquery.com/css/) operates.
|
|
5
6
|
|
|
7
|
+
### Why not just issue a pull request?
|
|
8
|
+
|
|
9
|
+
Well, NV wants to keep CSSOM fast (which I can appreciate) and CSS2Properties aren't required by the standard (though every browser has the interface). So I figured the path of least resistance would be to just modify this one class, publish it as a node module (that requires CSSOM) and then make a pull request of jsdom to use it.
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
----
|
|
9
|
-
Well, NV wants to keep CSSOM fast (which I can appreciate) and CSS2Properties aren't required by the standard (though every browser has the interface). So I figured the path of least resistence would be to just modify this one class, publish it as a node module (that requires CSSOM) and then make a pull request of jsdom to use it.
|
|
11
|
+
### How do I test this code?
|
|
10
12
|
|
|
11
|
-
How do I test this code?
|
|
12
|
-
---
|
|
13
13
|
`npm test` should do the trick, assuming you have the dev dependencies installed:
|
|
14
|
-
> ```
|
|
15
|
-
> $ npm test
|
|
16
|
-
>
|
|
17
|
-
> tests
|
|
18
|
-
> ✔ Verify Has Properties
|
|
19
|
-
> ✔ Verify Has Functions
|
|
20
|
-
> ✔ Verify Has Special Properties
|
|
21
|
-
> ✔ Test From Style String
|
|
22
|
-
> ✔ Test From Properties
|
|
23
|
-
> ✔ Test Shorthand Properties
|
|
24
|
-
> ✔ Test width and height Properties and null and empty strings
|
|
25
|
-
> ✔ Test Implicit Properties
|
|
26
|
-
> ```
|
|
27
14
|
|
|
15
|
+
```
|
|
16
|
+
$ npm test
|
|
17
|
+
|
|
18
|
+
tests
|
|
19
|
+
✔ Verify Has Properties
|
|
20
|
+
✔ Verify Has Functions
|
|
21
|
+
✔ Verify Has Special Properties
|
|
22
|
+
✔ Test From Style String
|
|
23
|
+
✔ Test From Properties
|
|
24
|
+
✔ Test Shorthand Properties
|
|
25
|
+
✔ Test width and height Properties and null and empty strings
|
|
26
|
+
✔ Test Implicit Properties
|
|
27
|
+
```
|
|
@@ -4,11 +4,7 @@
|
|
|
4
4
|
********************************************************************/
|
|
5
5
|
"use strict";
|
|
6
6
|
var CSSOM = require('cssom');
|
|
7
|
-
var
|
|
8
|
-
var path = require('path');
|
|
9
|
-
|
|
10
|
-
var camelToDashed = require('./parsers').camelToDashed;
|
|
11
|
-
var dashedToCamelCase = require('./parsers').dashedToCamelCase;
|
|
7
|
+
var validProperties = require('./validProperties');
|
|
12
8
|
|
|
13
9
|
/**
|
|
14
10
|
* @constructor
|
|
@@ -52,9 +48,13 @@ CSSStyleDeclaration.prototype = {
|
|
|
52
48
|
this.removeProperty(name);
|
|
53
49
|
return;
|
|
54
50
|
}
|
|
55
|
-
var
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
var lowercaseName = name.toLowerCase();
|
|
52
|
+
if (!validProperties.has(lowercaseName)) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
this[lowercaseName] = value;
|
|
57
|
+
this._importants[lowercaseName] = priority;
|
|
58
58
|
},
|
|
59
59
|
_setProperty: function (name, value, priority) {
|
|
60
60
|
if (value === undefined) {
|
package/lib/parsers.js
CHANGED
|
@@ -21,7 +21,7 @@ exports.TYPES = {
|
|
|
21
21
|
// rough regular expressions
|
|
22
22
|
var integerRegEx = /^[\-+]?[0-9]+$/;
|
|
23
23
|
var numberRegEx = /^[\-+]?[0-9]*\.[0-9]+$/;
|
|
24
|
-
var lengthRegEx = /^(0|[\-+]?[0-9]*\.?[0-9]+(in|cm|em|mm|pt|pc|px))$/;
|
|
24
|
+
var lengthRegEx = /^(0|[\-+]?[0-9]*\.?[0-9]+(in|cm|em|mm|pt|pc|px|ex|rem|vh|vw))$/;
|
|
25
25
|
var percentRegEx = /^[\-+]?[0-9]*\.?[0-9]+%$/;
|
|
26
26
|
var urlRegEx = /^url\(\s*([^\)]*)\s*\)$/;
|
|
27
27
|
var stringRegEx = /^(\"[^\"]*\"|\'[^\']*\')$/;
|
package/lib/properties.js
CHANGED
|
@@ -9,6 +9,28 @@
|
|
|
9
9
|
|
|
10
10
|
var external_dependency_parsers_0 = require("./parsers.js");
|
|
11
11
|
|
|
12
|
+
var alignContent_export_definition;
|
|
13
|
+
alignContent_export_definition = {
|
|
14
|
+
set: function (v) {
|
|
15
|
+
this._setProperty('align-content', v);
|
|
16
|
+
},
|
|
17
|
+
get: function () {
|
|
18
|
+
return this.getPropertyValue('align-content');
|
|
19
|
+
},
|
|
20
|
+
enumerable: true,
|
|
21
|
+
configurable: true
|
|
22
|
+
};
|
|
23
|
+
var alignItems_export_definition;
|
|
24
|
+
alignItems_export_definition = {
|
|
25
|
+
set: function (v) {
|
|
26
|
+
this._setProperty('align-items', v);
|
|
27
|
+
},
|
|
28
|
+
get: function () {
|
|
29
|
+
return this.getPropertyValue('align-items');
|
|
30
|
+
},
|
|
31
|
+
enumerable: true,
|
|
32
|
+
configurable: true
|
|
33
|
+
};
|
|
12
34
|
var alignmentBaseline_export_definition;
|
|
13
35
|
alignmentBaseline_export_definition = {
|
|
14
36
|
set: function (v) {
|
|
@@ -912,6 +934,10 @@ var borderSpacing_local_var_parse = function parse(v) {
|
|
|
912
934
|
return undefined;
|
|
913
935
|
}
|
|
914
936
|
|
|
937
|
+
if (v === 0) {
|
|
938
|
+
return "0px";
|
|
939
|
+
}
|
|
940
|
+
|
|
915
941
|
if (v.toLowerCase() === 'inherit') {
|
|
916
942
|
return v;
|
|
917
943
|
}
|
|
@@ -1402,6 +1428,39 @@ filter_export_definition = {
|
|
|
1402
1428
|
enumerable: true,
|
|
1403
1429
|
configurable: true
|
|
1404
1430
|
};
|
|
1431
|
+
var flexDirection_export_definition;
|
|
1432
|
+
flexDirection_export_definition = {
|
|
1433
|
+
set: function (v) {
|
|
1434
|
+
this._setProperty('flex-direction', v);
|
|
1435
|
+
},
|
|
1436
|
+
get: function () {
|
|
1437
|
+
return this.getPropertyValue('flex-direction');
|
|
1438
|
+
},
|
|
1439
|
+
enumerable: true,
|
|
1440
|
+
configurable: true
|
|
1441
|
+
};
|
|
1442
|
+
var flexFlow_export_definition;
|
|
1443
|
+
flexFlow_export_definition = {
|
|
1444
|
+
set: function (v) {
|
|
1445
|
+
this._setProperty('flex-flow', v);
|
|
1446
|
+
},
|
|
1447
|
+
get: function () {
|
|
1448
|
+
return this.getPropertyValue('flex-flow');
|
|
1449
|
+
},
|
|
1450
|
+
enumerable: true,
|
|
1451
|
+
configurable: true
|
|
1452
|
+
};
|
|
1453
|
+
var flexWrap_export_definition;
|
|
1454
|
+
flexWrap_export_definition = {
|
|
1455
|
+
set: function (v) {
|
|
1456
|
+
this._setProperty('flex-wrap', v);
|
|
1457
|
+
},
|
|
1458
|
+
get: function () {
|
|
1459
|
+
return this.getPropertyValue('flex-wrap');
|
|
1460
|
+
},
|
|
1461
|
+
enumerable: true,
|
|
1462
|
+
configurable: true
|
|
1463
|
+
};
|
|
1405
1464
|
var floodColor_export_definition;
|
|
1406
1465
|
floodColor_export_definition = {
|
|
1407
1466
|
set: function (v) {
|
|
@@ -1674,6 +1733,17 @@ imageRendering_export_definition = {
|
|
|
1674
1733
|
enumerable: true,
|
|
1675
1734
|
configurable: true
|
|
1676
1735
|
};
|
|
1736
|
+
var justifyContent_export_definition;
|
|
1737
|
+
justifyContent_export_definition = {
|
|
1738
|
+
set: function (v) {
|
|
1739
|
+
this._setProperty('justify-content', v);
|
|
1740
|
+
},
|
|
1741
|
+
get: function () {
|
|
1742
|
+
return this.getPropertyValue('justify-content');
|
|
1743
|
+
},
|
|
1744
|
+
enumerable: true,
|
|
1745
|
+
configurable: true
|
|
1746
|
+
};
|
|
1677
1747
|
var kerning_export_definition;
|
|
1678
1748
|
kerning_export_definition = {
|
|
1679
1749
|
set: function (v) {
|
|
@@ -2901,6 +2971,17 @@ top_export_definition = {
|
|
|
2901
2971
|
enumerable: true,
|
|
2902
2972
|
configurable: true
|
|
2903
2973
|
};
|
|
2974
|
+
var transform_export_definition;
|
|
2975
|
+
transform_export_definition = {
|
|
2976
|
+
set: function (v) {
|
|
2977
|
+
this._setProperty('transform', v);
|
|
2978
|
+
},
|
|
2979
|
+
get: function () {
|
|
2980
|
+
return this.getPropertyValue('transform');
|
|
2981
|
+
},
|
|
2982
|
+
enumerable: true,
|
|
2983
|
+
configurable: true
|
|
2984
|
+
};
|
|
2904
2985
|
var unicodeBidi_export_definition;
|
|
2905
2986
|
unicodeBidi_export_definition = {
|
|
2906
2987
|
set: function (v) {
|
|
@@ -5117,6 +5198,10 @@ zoom_export_definition = {
|
|
|
5117
5198
|
|
|
5118
5199
|
module.exports = function (prototype) {
|
|
5119
5200
|
Object.defineProperties(prototype, {
|
|
5201
|
+
alignContent: alignContent_export_definition,
|
|
5202
|
+
"align-content": alignContent_export_definition,
|
|
5203
|
+
alignItems: alignItems_export_definition,
|
|
5204
|
+
"align-items": alignItems_export_definition,
|
|
5120
5205
|
alignmentBaseline: alignmentBaseline_export_definition,
|
|
5121
5206
|
"alignment-baseline": alignmentBaseline_export_definition,
|
|
5122
5207
|
azimuth: azimuth_export_definition,
|
|
@@ -5258,6 +5343,12 @@ module.exports = function (prototype) {
|
|
|
5258
5343
|
fillRule: fillRule_export_definition,
|
|
5259
5344
|
"fill-rule": fillRule_export_definition,
|
|
5260
5345
|
filter: filter_export_definition,
|
|
5346
|
+
flexDirection: flexDirection_export_definition,
|
|
5347
|
+
"flex-direction": flexDirection_export_definition,
|
|
5348
|
+
flexFlow: flexFlow_export_definition,
|
|
5349
|
+
"flex-flow": flexFlow_export_definition,
|
|
5350
|
+
flexWrap: flexWrap_export_definition,
|
|
5351
|
+
"flex-wrap": flexWrap_export_definition,
|
|
5261
5352
|
floodColor: floodColor_export_definition,
|
|
5262
5353
|
"flood-color": floodColor_export_definition,
|
|
5263
5354
|
floodOpacity: floodOpacity_export_definition,
|
|
@@ -5286,6 +5377,8 @@ module.exports = function (prototype) {
|
|
|
5286
5377
|
height: height_export_definition,
|
|
5287
5378
|
imageRendering: imageRendering_export_definition,
|
|
5288
5379
|
"image-rendering": imageRendering_export_definition,
|
|
5380
|
+
justifyContent: justifyContent_export_definition,
|
|
5381
|
+
"justify-content": justifyContent_export_definition,
|
|
5289
5382
|
kerning: kerning_export_definition,
|
|
5290
5383
|
left: left_export_definition,
|
|
5291
5384
|
letterSpacing: letterSpacing_export_definition,
|
|
@@ -5459,6 +5552,7 @@ module.exports = function (prototype) {
|
|
|
5459
5552
|
textUnderlineWidth: textUnderlineWidth_export_definition,
|
|
5460
5553
|
"text-underline-width": textUnderlineWidth_export_definition,
|
|
5461
5554
|
top: top_export_definition,
|
|
5555
|
+
transform: transform_export_definition,
|
|
5462
5556
|
unicodeBidi: unicodeBidi_export_definition,
|
|
5463
5557
|
"unicode-bidi": unicodeBidi_export_definition,
|
|
5464
5558
|
unicodeRange: unicodeRange_export_definition,
|
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// autogenerated
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
*
|
|
7
|
+
* http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSS2Properties
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var validProperties = new Set();
|
|
11
|
+
validProperties.add("align-content");
|
|
12
|
+
validProperties.add("align-items");
|
|
13
|
+
validProperties.add("alignment-baseline");
|
|
14
|
+
validProperties.add("azimuth");
|
|
15
|
+
validProperties.add("background");
|
|
16
|
+
validProperties.add("background-attachment");
|
|
17
|
+
validProperties.add("background-clip");
|
|
18
|
+
validProperties.add("background-color");
|
|
19
|
+
validProperties.add("background-image");
|
|
20
|
+
validProperties.add("background-origin");
|
|
21
|
+
validProperties.add("background-position");
|
|
22
|
+
validProperties.add("background-position-x");
|
|
23
|
+
validProperties.add("background-position-y");
|
|
24
|
+
validProperties.add("background-repeat");
|
|
25
|
+
validProperties.add("background-repeat-x");
|
|
26
|
+
validProperties.add("background-repeat-y");
|
|
27
|
+
validProperties.add("background-size");
|
|
28
|
+
validProperties.add("baseline-shift");
|
|
29
|
+
validProperties.add("border");
|
|
30
|
+
validProperties.add("border-bottom");
|
|
31
|
+
validProperties.add("border-bottom-color");
|
|
32
|
+
validProperties.add("border-bottom-left-radius");
|
|
33
|
+
validProperties.add("border-bottom-right-radius");
|
|
34
|
+
validProperties.add("border-bottom-style");
|
|
35
|
+
validProperties.add("border-bottom-width");
|
|
36
|
+
validProperties.add("border-collapse");
|
|
37
|
+
validProperties.add("border-color");
|
|
38
|
+
validProperties.add("border-image");
|
|
39
|
+
validProperties.add("border-image-outset");
|
|
40
|
+
validProperties.add("border-image-repeat");
|
|
41
|
+
validProperties.add("border-image-slice");
|
|
42
|
+
validProperties.add("border-image-source");
|
|
43
|
+
validProperties.add("border-image-width");
|
|
44
|
+
validProperties.add("border-left");
|
|
45
|
+
validProperties.add("border-left-color");
|
|
46
|
+
validProperties.add("border-left-style");
|
|
47
|
+
validProperties.add("border-left-width");
|
|
48
|
+
validProperties.add("border-radius");
|
|
49
|
+
validProperties.add("border-right");
|
|
50
|
+
validProperties.add("border-right-color");
|
|
51
|
+
validProperties.add("border-right-style");
|
|
52
|
+
validProperties.add("border-right-width");
|
|
53
|
+
validProperties.add("border-spacing");
|
|
54
|
+
validProperties.add("border-style");
|
|
55
|
+
validProperties.add("border-top");
|
|
56
|
+
validProperties.add("border-top-color");
|
|
57
|
+
validProperties.add("border-top-left-radius");
|
|
58
|
+
validProperties.add("border-top-right-radius");
|
|
59
|
+
validProperties.add("border-top-style");
|
|
60
|
+
validProperties.add("border-top-width");
|
|
61
|
+
validProperties.add("border-width");
|
|
62
|
+
validProperties.add("bottom");
|
|
63
|
+
validProperties.add("box-shadow");
|
|
64
|
+
validProperties.add("box-sizing");
|
|
65
|
+
validProperties.add("caption-side");
|
|
66
|
+
validProperties.add("clear");
|
|
67
|
+
validProperties.add("clip");
|
|
68
|
+
validProperties.add("color");
|
|
69
|
+
validProperties.add("color-interpolation");
|
|
70
|
+
validProperties.add("color-interpolation-filters");
|
|
71
|
+
validProperties.add("color-profile");
|
|
72
|
+
validProperties.add("color-rendering");
|
|
73
|
+
validProperties.add("content");
|
|
74
|
+
validProperties.add("counter-increment");
|
|
75
|
+
validProperties.add("counter-reset");
|
|
76
|
+
validProperties.add("css-float");
|
|
77
|
+
validProperties.add("cue");
|
|
78
|
+
validProperties.add("cue-after");
|
|
79
|
+
validProperties.add("cue-before");
|
|
80
|
+
validProperties.add("cursor");
|
|
81
|
+
validProperties.add("direction");
|
|
82
|
+
validProperties.add("display");
|
|
83
|
+
validProperties.add("dominant-baseline");
|
|
84
|
+
validProperties.add("elevation");
|
|
85
|
+
validProperties.add("empty-cells");
|
|
86
|
+
validProperties.add("enable-background");
|
|
87
|
+
validProperties.add("fill");
|
|
88
|
+
validProperties.add("fill-opacity");
|
|
89
|
+
validProperties.add("fill-rule");
|
|
90
|
+
validProperties.add("filter");
|
|
91
|
+
validProperties.add("flex-direction");
|
|
92
|
+
validProperties.add("flex-flow");
|
|
93
|
+
validProperties.add("flex-wrap");
|
|
94
|
+
validProperties.add("flood-color");
|
|
95
|
+
validProperties.add("flood-opacity");
|
|
96
|
+
validProperties.add("font");
|
|
97
|
+
validProperties.add("font-family");
|
|
98
|
+
validProperties.add("font-size");
|
|
99
|
+
validProperties.add("font-size-adjust");
|
|
100
|
+
validProperties.add("font-stretch");
|
|
101
|
+
validProperties.add("font-style");
|
|
102
|
+
validProperties.add("font-variant");
|
|
103
|
+
validProperties.add("font-weight");
|
|
104
|
+
validProperties.add("glyph-orientation-horizontal");
|
|
105
|
+
validProperties.add("glyph-orientation-vertical");
|
|
106
|
+
validProperties.add("height");
|
|
107
|
+
validProperties.add("image-rendering");
|
|
108
|
+
validProperties.add("justify-content");
|
|
109
|
+
validProperties.add("kerning");
|
|
110
|
+
validProperties.add("left");
|
|
111
|
+
validProperties.add("letter-spacing");
|
|
112
|
+
validProperties.add("lighting-color");
|
|
113
|
+
validProperties.add("line-height");
|
|
114
|
+
validProperties.add("list-style");
|
|
115
|
+
validProperties.add("list-style-image");
|
|
116
|
+
validProperties.add("list-style-position");
|
|
117
|
+
validProperties.add("list-style-type");
|
|
118
|
+
validProperties.add("margin");
|
|
119
|
+
validProperties.add("margin-bottom");
|
|
120
|
+
validProperties.add("margin-left");
|
|
121
|
+
validProperties.add("margin-right");
|
|
122
|
+
validProperties.add("margin-top");
|
|
123
|
+
validProperties.add("marker");
|
|
124
|
+
validProperties.add("marker-end");
|
|
125
|
+
validProperties.add("marker-mid");
|
|
126
|
+
validProperties.add("marker-offset");
|
|
127
|
+
validProperties.add("marker-start");
|
|
128
|
+
validProperties.add("marks");
|
|
129
|
+
validProperties.add("mask");
|
|
130
|
+
validProperties.add("max-height");
|
|
131
|
+
validProperties.add("max-width");
|
|
132
|
+
validProperties.add("min-height");
|
|
133
|
+
validProperties.add("min-width");
|
|
134
|
+
validProperties.add("opacity");
|
|
135
|
+
validProperties.add("orphans");
|
|
136
|
+
validProperties.add("outline");
|
|
137
|
+
validProperties.add("outline-color");
|
|
138
|
+
validProperties.add("outline-offset");
|
|
139
|
+
validProperties.add("outline-style");
|
|
140
|
+
validProperties.add("outline-width");
|
|
141
|
+
validProperties.add("overflow");
|
|
142
|
+
validProperties.add("overflow-x");
|
|
143
|
+
validProperties.add("overflow-y");
|
|
144
|
+
validProperties.add("padding");
|
|
145
|
+
validProperties.add("padding-bottom");
|
|
146
|
+
validProperties.add("padding-left");
|
|
147
|
+
validProperties.add("padding-right");
|
|
148
|
+
validProperties.add("padding-top");
|
|
149
|
+
validProperties.add("page");
|
|
150
|
+
validProperties.add("page-break-after");
|
|
151
|
+
validProperties.add("page-break-before");
|
|
152
|
+
validProperties.add("page-break-inside");
|
|
153
|
+
validProperties.add("pause");
|
|
154
|
+
validProperties.add("pause-after");
|
|
155
|
+
validProperties.add("pause-before");
|
|
156
|
+
validProperties.add("pitch");
|
|
157
|
+
validProperties.add("pitch-range");
|
|
158
|
+
validProperties.add("play-during");
|
|
159
|
+
validProperties.add("pointer-events");
|
|
160
|
+
validProperties.add("position");
|
|
161
|
+
validProperties.add("quotes");
|
|
162
|
+
validProperties.add("resize");
|
|
163
|
+
validProperties.add("richness");
|
|
164
|
+
validProperties.add("right");
|
|
165
|
+
validProperties.add("shape-rendering");
|
|
166
|
+
validProperties.add("size");
|
|
167
|
+
validProperties.add("speak");
|
|
168
|
+
validProperties.add("speak-header");
|
|
169
|
+
validProperties.add("speak-numeral");
|
|
170
|
+
validProperties.add("speak-punctuation");
|
|
171
|
+
validProperties.add("speech-rate");
|
|
172
|
+
validProperties.add("src");
|
|
173
|
+
validProperties.add("stop-color");
|
|
174
|
+
validProperties.add("stop-opacity");
|
|
175
|
+
validProperties.add("stress");
|
|
176
|
+
validProperties.add("stroke");
|
|
177
|
+
validProperties.add("stroke-dasharray");
|
|
178
|
+
validProperties.add("stroke-dashoffset");
|
|
179
|
+
validProperties.add("stroke-linecap");
|
|
180
|
+
validProperties.add("stroke-linejoin");
|
|
181
|
+
validProperties.add("stroke-miterlimit");
|
|
182
|
+
validProperties.add("stroke-opacity");
|
|
183
|
+
validProperties.add("stroke-width");
|
|
184
|
+
validProperties.add("table-layout");
|
|
185
|
+
validProperties.add("text-align");
|
|
186
|
+
validProperties.add("text-anchor");
|
|
187
|
+
validProperties.add("text-decoration");
|
|
188
|
+
validProperties.add("text-indent");
|
|
189
|
+
validProperties.add("text-line-through");
|
|
190
|
+
validProperties.add("text-line-through-color");
|
|
191
|
+
validProperties.add("text-line-through-mode");
|
|
192
|
+
validProperties.add("text-line-through-style");
|
|
193
|
+
validProperties.add("text-line-through-width");
|
|
194
|
+
validProperties.add("text-overflow");
|
|
195
|
+
validProperties.add("text-overline");
|
|
196
|
+
validProperties.add("text-overline-color");
|
|
197
|
+
validProperties.add("text-overline-mode");
|
|
198
|
+
validProperties.add("text-overline-style");
|
|
199
|
+
validProperties.add("text-overline-width");
|
|
200
|
+
validProperties.add("text-rendering");
|
|
201
|
+
validProperties.add("text-shadow");
|
|
202
|
+
validProperties.add("text-transform");
|
|
203
|
+
validProperties.add("text-underline");
|
|
204
|
+
validProperties.add("text-underline-color");
|
|
205
|
+
validProperties.add("text-underline-mode");
|
|
206
|
+
validProperties.add("text-underline-style");
|
|
207
|
+
validProperties.add("text-underline-width");
|
|
208
|
+
validProperties.add("top");
|
|
209
|
+
validProperties.add("transform");
|
|
210
|
+
validProperties.add("unicode-bidi");
|
|
211
|
+
validProperties.add("unicode-range");
|
|
212
|
+
validProperties.add("vector-effect");
|
|
213
|
+
validProperties.add("vertical-align");
|
|
214
|
+
validProperties.add("visibility");
|
|
215
|
+
validProperties.add("voice-family");
|
|
216
|
+
validProperties.add("volume");
|
|
217
|
+
validProperties.add("webkit-animation");
|
|
218
|
+
validProperties.add("webkit-animation-delay");
|
|
219
|
+
validProperties.add("webkit-animation-direction");
|
|
220
|
+
validProperties.add("webkit-animation-duration");
|
|
221
|
+
validProperties.add("webkit-animation-fill-mode");
|
|
222
|
+
validProperties.add("webkit-animation-iteration-count");
|
|
223
|
+
validProperties.add("webkit-animation-name");
|
|
224
|
+
validProperties.add("webkit-animation-play-state");
|
|
225
|
+
validProperties.add("webkit-animation-timing-function");
|
|
226
|
+
validProperties.add("webkit-appearance");
|
|
227
|
+
validProperties.add("webkit-aspect-ratio");
|
|
228
|
+
validProperties.add("webkit-backface-visibility");
|
|
229
|
+
validProperties.add("webkit-background-clip");
|
|
230
|
+
validProperties.add("webkit-background-composite");
|
|
231
|
+
validProperties.add("webkit-background-origin");
|
|
232
|
+
validProperties.add("webkit-background-size");
|
|
233
|
+
validProperties.add("webkit-border-after");
|
|
234
|
+
validProperties.add("webkit-border-after-color");
|
|
235
|
+
validProperties.add("webkit-border-after-style");
|
|
236
|
+
validProperties.add("webkit-border-after-width");
|
|
237
|
+
validProperties.add("webkit-border-before");
|
|
238
|
+
validProperties.add("webkit-border-before-color");
|
|
239
|
+
validProperties.add("webkit-border-before-style");
|
|
240
|
+
validProperties.add("webkit-border-before-width");
|
|
241
|
+
validProperties.add("webkit-border-end");
|
|
242
|
+
validProperties.add("webkit-border-end-color");
|
|
243
|
+
validProperties.add("webkit-border-end-style");
|
|
244
|
+
validProperties.add("webkit-border-end-width");
|
|
245
|
+
validProperties.add("webkit-border-fit");
|
|
246
|
+
validProperties.add("webkit-border-horizontal-spacing");
|
|
247
|
+
validProperties.add("webkit-border-image");
|
|
248
|
+
validProperties.add("webkit-border-radius");
|
|
249
|
+
validProperties.add("webkit-border-start");
|
|
250
|
+
validProperties.add("webkit-border-start-color");
|
|
251
|
+
validProperties.add("webkit-border-start-style");
|
|
252
|
+
validProperties.add("webkit-border-start-width");
|
|
253
|
+
validProperties.add("webkit-border-vertical-spacing");
|
|
254
|
+
validProperties.add("webkit-box-align");
|
|
255
|
+
validProperties.add("webkit-box-direction");
|
|
256
|
+
validProperties.add("webkit-box-flex");
|
|
257
|
+
validProperties.add("webkit-box-flex-group");
|
|
258
|
+
validProperties.add("webkit-box-lines");
|
|
259
|
+
validProperties.add("webkit-box-ordinal-group");
|
|
260
|
+
validProperties.add("webkit-box-orient");
|
|
261
|
+
validProperties.add("webkit-box-pack");
|
|
262
|
+
validProperties.add("webkit-box-reflect");
|
|
263
|
+
validProperties.add("webkit-box-shadow");
|
|
264
|
+
validProperties.add("webkit-color-correction");
|
|
265
|
+
validProperties.add("webkit-column-axis");
|
|
266
|
+
validProperties.add("webkit-column-break-after");
|
|
267
|
+
validProperties.add("webkit-column-break-before");
|
|
268
|
+
validProperties.add("webkit-column-break-inside");
|
|
269
|
+
validProperties.add("webkit-column-count");
|
|
270
|
+
validProperties.add("webkit-column-gap");
|
|
271
|
+
validProperties.add("webkit-column-rule");
|
|
272
|
+
validProperties.add("webkit-column-rule-color");
|
|
273
|
+
validProperties.add("webkit-column-rule-style");
|
|
274
|
+
validProperties.add("webkit-column-rule-width");
|
|
275
|
+
validProperties.add("webkit-column-span");
|
|
276
|
+
validProperties.add("webkit-column-width");
|
|
277
|
+
validProperties.add("webkit-columns");
|
|
278
|
+
validProperties.add("webkit-filter");
|
|
279
|
+
validProperties.add("webkit-flex-align");
|
|
280
|
+
validProperties.add("webkit-flex-direction");
|
|
281
|
+
validProperties.add("webkit-flex-flow");
|
|
282
|
+
validProperties.add("webkit-flex-item-align");
|
|
283
|
+
validProperties.add("webkit-flex-line-pack");
|
|
284
|
+
validProperties.add("webkit-flex-order");
|
|
285
|
+
validProperties.add("webkit-flex-pack");
|
|
286
|
+
validProperties.add("webkit-flex-wrap");
|
|
287
|
+
validProperties.add("webkit-flow-from");
|
|
288
|
+
validProperties.add("webkit-flow-into");
|
|
289
|
+
validProperties.add("webkit-font-feature-settings");
|
|
290
|
+
validProperties.add("webkit-font-kerning");
|
|
291
|
+
validProperties.add("webkit-font-size-delta");
|
|
292
|
+
validProperties.add("webkit-font-smoothing");
|
|
293
|
+
validProperties.add("webkit-font-variant-ligatures");
|
|
294
|
+
validProperties.add("webkit-highlight");
|
|
295
|
+
validProperties.add("webkit-hyphenate-character");
|
|
296
|
+
validProperties.add("webkit-hyphenate-limit-after");
|
|
297
|
+
validProperties.add("webkit-hyphenate-limit-before");
|
|
298
|
+
validProperties.add("webkit-hyphenate-limit-lines");
|
|
299
|
+
validProperties.add("webkit-hyphens");
|
|
300
|
+
validProperties.add("webkit-line-align");
|
|
301
|
+
validProperties.add("webkit-line-box-contain");
|
|
302
|
+
validProperties.add("webkit-line-break");
|
|
303
|
+
validProperties.add("webkit-line-clamp");
|
|
304
|
+
validProperties.add("webkit-line-grid");
|
|
305
|
+
validProperties.add("webkit-line-snap");
|
|
306
|
+
validProperties.add("webkit-locale");
|
|
307
|
+
validProperties.add("webkit-logical-height");
|
|
308
|
+
validProperties.add("webkit-logical-width");
|
|
309
|
+
validProperties.add("webkit-margin-after");
|
|
310
|
+
validProperties.add("webkit-margin-after-collapse");
|
|
311
|
+
validProperties.add("webkit-margin-before");
|
|
312
|
+
validProperties.add("webkit-margin-before-collapse");
|
|
313
|
+
validProperties.add("webkit-margin-bottom-collapse");
|
|
314
|
+
validProperties.add("webkit-margin-collapse");
|
|
315
|
+
validProperties.add("webkit-margin-end");
|
|
316
|
+
validProperties.add("webkit-margin-start");
|
|
317
|
+
validProperties.add("webkit-margin-top-collapse");
|
|
318
|
+
validProperties.add("webkit-marquee");
|
|
319
|
+
validProperties.add("webkit-marquee-direction");
|
|
320
|
+
validProperties.add("webkit-marquee-increment");
|
|
321
|
+
validProperties.add("webkit-marquee-repetition");
|
|
322
|
+
validProperties.add("webkit-marquee-speed");
|
|
323
|
+
validProperties.add("webkit-marquee-style");
|
|
324
|
+
validProperties.add("webkit-mask");
|
|
325
|
+
validProperties.add("webkit-mask-attachment");
|
|
326
|
+
validProperties.add("webkit-mask-box-image");
|
|
327
|
+
validProperties.add("webkit-mask-box-image-outset");
|
|
328
|
+
validProperties.add("webkit-mask-box-image-repeat");
|
|
329
|
+
validProperties.add("webkit-mask-box-image-slice");
|
|
330
|
+
validProperties.add("webkit-mask-box-image-source");
|
|
331
|
+
validProperties.add("webkit-mask-box-image-width");
|
|
332
|
+
validProperties.add("webkit-mask-clip");
|
|
333
|
+
validProperties.add("webkit-mask-composite");
|
|
334
|
+
validProperties.add("webkit-mask-image");
|
|
335
|
+
validProperties.add("webkit-mask-origin");
|
|
336
|
+
validProperties.add("webkit-mask-position");
|
|
337
|
+
validProperties.add("webkit-mask-position-x");
|
|
338
|
+
validProperties.add("webkit-mask-position-y");
|
|
339
|
+
validProperties.add("webkit-mask-repeat");
|
|
340
|
+
validProperties.add("webkit-mask-repeat-x");
|
|
341
|
+
validProperties.add("webkit-mask-repeat-y");
|
|
342
|
+
validProperties.add("webkit-mask-size");
|
|
343
|
+
validProperties.add("webkit-match-nearest-mail-blockquote-color");
|
|
344
|
+
validProperties.add("webkit-max-logical-height");
|
|
345
|
+
validProperties.add("webkit-max-logical-width");
|
|
346
|
+
validProperties.add("webkit-min-logical-height");
|
|
347
|
+
validProperties.add("webkit-min-logical-width");
|
|
348
|
+
validProperties.add("webkit-nbsp-mode");
|
|
349
|
+
validProperties.add("webkit-overflow-scrolling");
|
|
350
|
+
validProperties.add("webkit-padding-after");
|
|
351
|
+
validProperties.add("webkit-padding-before");
|
|
352
|
+
validProperties.add("webkit-padding-end");
|
|
353
|
+
validProperties.add("webkit-padding-start");
|
|
354
|
+
validProperties.add("webkit-perspective");
|
|
355
|
+
validProperties.add("webkit-perspective-origin");
|
|
356
|
+
validProperties.add("webkit-perspective-origin-x");
|
|
357
|
+
validProperties.add("webkit-perspective-origin-y");
|
|
358
|
+
validProperties.add("webkit-print-color-adjust");
|
|
359
|
+
validProperties.add("webkit-region-break-after");
|
|
360
|
+
validProperties.add("webkit-region-break-before");
|
|
361
|
+
validProperties.add("webkit-region-break-inside");
|
|
362
|
+
validProperties.add("webkit-region-overflow");
|
|
363
|
+
validProperties.add("webkit-rtl-ordering");
|
|
364
|
+
validProperties.add("webkit-svg-shadow");
|
|
365
|
+
validProperties.add("webkit-tap-highlight-color");
|
|
366
|
+
validProperties.add("webkit-text-combine");
|
|
367
|
+
validProperties.add("webkit-text-decorations-in-effect");
|
|
368
|
+
validProperties.add("webkit-text-emphasis");
|
|
369
|
+
validProperties.add("webkit-text-emphasis-color");
|
|
370
|
+
validProperties.add("webkit-text-emphasis-position");
|
|
371
|
+
validProperties.add("webkit-text-emphasis-style");
|
|
372
|
+
validProperties.add("webkit-text-fill-color");
|
|
373
|
+
validProperties.add("webkit-text-orientation");
|
|
374
|
+
validProperties.add("webkit-text-security");
|
|
375
|
+
validProperties.add("webkit-text-size-adjust");
|
|
376
|
+
validProperties.add("webkit-text-stroke");
|
|
377
|
+
validProperties.add("webkit-text-stroke-color");
|
|
378
|
+
validProperties.add("webkit-text-stroke-width");
|
|
379
|
+
validProperties.add("webkit-transform");
|
|
380
|
+
validProperties.add("webkit-transform-origin");
|
|
381
|
+
validProperties.add("webkit-transform-origin-x");
|
|
382
|
+
validProperties.add("webkit-transform-origin-y");
|
|
383
|
+
validProperties.add("webkit-transform-origin-z");
|
|
384
|
+
validProperties.add("webkit-transform-style");
|
|
385
|
+
validProperties.add("webkit-transition");
|
|
386
|
+
validProperties.add("webkit-transition-delay");
|
|
387
|
+
validProperties.add("webkit-transition-duration");
|
|
388
|
+
validProperties.add("webkit-transition-property");
|
|
389
|
+
validProperties.add("webkit-transition-timing-function");
|
|
390
|
+
validProperties.add("webkit-user-drag");
|
|
391
|
+
validProperties.add("webkit-user-modify");
|
|
392
|
+
validProperties.add("webkit-user-select");
|
|
393
|
+
validProperties.add("webkit-wrap");
|
|
394
|
+
validProperties.add("webkit-wrap-flow");
|
|
395
|
+
validProperties.add("webkit-wrap-margin");
|
|
396
|
+
validProperties.add("webkit-wrap-padding");
|
|
397
|
+
validProperties.add("webkit-wrap-shape-inside");
|
|
398
|
+
validProperties.add("webkit-wrap-shape-outside");
|
|
399
|
+
validProperties.add("webkit-wrap-through");
|
|
400
|
+
validProperties.add("webkit-writing-mode");
|
|
401
|
+
validProperties.add("white-space");
|
|
402
|
+
validProperties.add("widows");
|
|
403
|
+
validProperties.add("width");
|
|
404
|
+
validProperties.add("word-break");
|
|
405
|
+
validProperties.add("word-spacing");
|
|
406
|
+
validProperties.add("word-wrap");
|
|
407
|
+
validProperties.add("writing-mode");
|
|
408
|
+
validProperties.add("z-index");
|
|
409
|
+
validProperties.add("zoom");
|
|
410
|
+
module.exports = validProperties;
|
package/package.json
CHANGED
|
@@ -6,16 +6,21 @@
|
|
|
6
6
|
"CSSStyleDeclaration",
|
|
7
7
|
"StyleSheet"
|
|
8
8
|
],
|
|
9
|
-
"version": "
|
|
10
|
-
"homepage": "https://github.com/
|
|
9
|
+
"version": "1.1.1",
|
|
10
|
+
"homepage": "https://github.com/jsakas/CSSStyleDeclaration",
|
|
11
11
|
"maintainers": [
|
|
12
12
|
{
|
|
13
|
-
"name": "
|
|
14
|
-
"email": "
|
|
15
|
-
"url": "
|
|
13
|
+
"name": "Jon Sakas",
|
|
14
|
+
"email": "jon.sakas@gmail.com",
|
|
15
|
+
"url": "http://jon.sakas.co/"
|
|
16
16
|
}
|
|
17
17
|
],
|
|
18
18
|
"contributors": [
|
|
19
|
+
{
|
|
20
|
+
"name": "Chad Walker",
|
|
21
|
+
"email": "chad@chad-cat-lore-eddie.com",
|
|
22
|
+
"url": "https://github.com/chad3814"
|
|
23
|
+
},
|
|
19
24
|
{
|
|
20
25
|
"name": "Nikita Vasilyev",
|
|
21
26
|
"email": "me@elv1s.ru"
|
|
@@ -27,8 +32,8 @@
|
|
|
27
32
|
"name": "Forbes Lindesay"
|
|
28
33
|
}
|
|
29
34
|
],
|
|
30
|
-
"repository": "
|
|
31
|
-
"bugs": "https://github.com/
|
|
35
|
+
"repository": "jsakas/CSSStyleDeclaration",
|
|
36
|
+
"bugs": "https://github.com/jsakas/CSSStyleDeclaration/issues",
|
|
32
37
|
"directories": {
|
|
33
38
|
"lib": "./lib"
|
|
34
39
|
},
|
|
@@ -45,8 +50,8 @@
|
|
|
45
50
|
"resolve": "~1.1.7"
|
|
46
51
|
},
|
|
47
52
|
"scripts": {
|
|
48
|
-
"test": "./scripts/
|
|
49
|
-
"
|
|
53
|
+
"test": "node ./scripts/generate_properties.js && node ./scripts/generate_valid_properties.js && nodeunit tests",
|
|
54
|
+
"prepare": "node ./scripts/generate_properties.js && node ./scripts/generate_valid_properties.js"
|
|
50
55
|
},
|
|
51
56
|
"license": "MIT"
|
|
52
57
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const t = require("babel-types");
|
|
6
|
+
const generate = require("babel-generator").default;
|
|
7
|
+
const camelToDashed = require("../lib/parsers").camelToDashed;
|
|
8
|
+
|
|
9
|
+
const dahsedProperties = fs
|
|
10
|
+
.readdirSync(path.resolve(__dirname, "../lib/properties"))
|
|
11
|
+
.filter(propertyFile => propertyFile.substr(-3) === ".js")
|
|
12
|
+
.map(propertyFile => camelToDashed(propertyFile.replace('.js', '')))
|
|
13
|
+
|
|
14
|
+
const valid_properties_out_file = fs.createWriteStream(
|
|
15
|
+
path.resolve(__dirname, "../lib/validProperties.js"),
|
|
16
|
+
{ encoding: "utf-8" }
|
|
17
|
+
);
|
|
18
|
+
valid_properties_out_file.write("'use strict';\n\n// autogenerated\n\n");
|
|
19
|
+
valid_properties_out_file.write('/*\n *\n * http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSS2Properties\n */\n\n');
|
|
20
|
+
|
|
21
|
+
const validPropertiesStatements = [];
|
|
22
|
+
validPropertiesStatements.push(
|
|
23
|
+
t.variableDeclaration("var", [
|
|
24
|
+
t.variableDeclarator(
|
|
25
|
+
t.identifier("validProperties"),
|
|
26
|
+
t.newExpression(t.identifier("Set"), [])
|
|
27
|
+
)
|
|
28
|
+
])
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
dahsedProperties.forEach(property => {
|
|
32
|
+
validPropertiesStatements.push(
|
|
33
|
+
t.expressionStatement(
|
|
34
|
+
t.callExpression(
|
|
35
|
+
t.memberExpression(
|
|
36
|
+
t.identifier("validProperties"),
|
|
37
|
+
t.identifier("add")
|
|
38
|
+
),
|
|
39
|
+
[t.stringLiteral(property)]
|
|
40
|
+
)
|
|
41
|
+
)
|
|
42
|
+
);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
validPropertiesStatements.push(
|
|
46
|
+
t.expressionStatement(
|
|
47
|
+
t.assignmentExpression(
|
|
48
|
+
"=",
|
|
49
|
+
t.memberExpression(t.identifier("module"), t.identifier("exports")),
|
|
50
|
+
t.identifier("validProperties")
|
|
51
|
+
)
|
|
52
|
+
)
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
valid_properties_out_file.write(
|
|
56
|
+
generate(t.program(validPropertiesStatements)).code + "\n"
|
|
57
|
+
);
|
|
58
|
+
valid_properties_out_file.end(function(err) {
|
|
59
|
+
if (err) {
|
|
60
|
+
throw err;
|
|
61
|
+
}
|
|
62
|
+
});
|
package/tests/tests.js
CHANGED
|
@@ -56,9 +56,9 @@ module.exports = {
|
|
|
56
56
|
'Test From Style String': function (test) {
|
|
57
57
|
var style = new cssstyle.CSSStyleDeclaration();
|
|
58
58
|
test.expect(8);
|
|
59
|
-
style.cssText = 'color: blue; background-color: red; width: 78
|
|
60
|
-
test.ok(
|
|
61
|
-
test.ok('color: blue; background-color: red; width: 78%;' === style.cssText, 'cssText is wrong');
|
|
59
|
+
style.cssText = 'color: blue; background-color: red; width: 78%; height: 50vh;';
|
|
60
|
+
test.ok(4 === style.length, 'length is not 4');
|
|
61
|
+
test.ok('color: blue; background-color: red; width: 78%; height: 50vh;' === style.cssText, 'cssText is wrong');
|
|
62
62
|
test.ok('blue' === style.getPropertyValue('color'), "getPropertyValue('color') failed");
|
|
63
63
|
test.ok('color' === style.item(0), 'item(0) failed');
|
|
64
64
|
test.ok('background-color' === style[1], 'style[1] failed');
|
|
@@ -108,13 +108,17 @@ module.exports = {
|
|
|
108
108
|
},
|
|
109
109
|
'Test width and height Properties and null and empty strings': function (test) {
|
|
110
110
|
var style = new cssstyle.CSSStyleDeclaration();
|
|
111
|
-
test.expect(
|
|
111
|
+
test.expect(9);
|
|
112
112
|
style.height = 6;
|
|
113
113
|
test.ok('' === style.height, 'height does not remain unset');
|
|
114
114
|
style.width = 0;
|
|
115
115
|
test.ok('0px' === style.width, 'width is not 0px');
|
|
116
116
|
style.height = '34%';
|
|
117
117
|
test.ok('34%' === style.height, 'height is not 34%');
|
|
118
|
+
style.height = '100vh';
|
|
119
|
+
test.ok('100vh' === style.height, 'height is not 100vh');
|
|
120
|
+
style.height = '100vw';
|
|
121
|
+
test.ok('100vw' === style.height, 'height is not 100vw');
|
|
118
122
|
style.height = '';
|
|
119
123
|
test.ok(style.length === 1, 'length is not 1');
|
|
120
124
|
test.ok('width: 0px;' === style.cssText, 'cssText is not "width: 0px;"');
|
|
@@ -393,6 +397,16 @@ module.exports = {
|
|
|
393
397
|
test.equal(style.marginTop, '0px', 'margin-top is not 0px');
|
|
394
398
|
test.done();
|
|
395
399
|
},
|
|
400
|
+
'Make sure setting ex units to a padding or margin works': function (test) {
|
|
401
|
+
var style = new cssstyle.CSSStyleDeclaration();
|
|
402
|
+
test.expect(2);
|
|
403
|
+
style.padding = '1ex';
|
|
404
|
+
test.equal(style.cssText, 'padding: 1ex;', 'padding is not 1ex');
|
|
405
|
+
style.margin = '1em';
|
|
406
|
+
style.marginTop = '0.5ex'
|
|
407
|
+
test.equal(style.marginTop, '0.5ex', 'margin-top is not 0.5ex');
|
|
408
|
+
test.done();
|
|
409
|
+
},
|
|
396
410
|
'Make sure setting null to background works': function (test) {
|
|
397
411
|
var style = new cssstyle.CSSStyleDeclaration();
|
|
398
412
|
test.expect(2);
|
|
@@ -401,5 +415,36 @@ module.exports = {
|
|
|
401
415
|
style.background = null;
|
|
402
416
|
test.equal(style.cssText, '', 'cssText is not empty');
|
|
403
417
|
test.done();
|
|
418
|
+
},
|
|
419
|
+
'Flex properties should keep their values': function (test) {
|
|
420
|
+
var style = new cssstyle.CSSStyleDeclaration();
|
|
421
|
+
test.expect(2);
|
|
422
|
+
style.flexDirection = 'column';
|
|
423
|
+
test.equal(style.cssText, 'flex-direction: column;', 'flex-direction is not column');
|
|
424
|
+
style.flexDirection = 'row';
|
|
425
|
+
test.equal(style.cssText, 'flex-direction: row;', 'flex-direction is not column');
|
|
426
|
+
test.done();
|
|
427
|
+
},
|
|
428
|
+
'Make sure camelCase properties are not assigned with `.setProperty()`': function(test) {
|
|
429
|
+
var style = new cssstyle.CSSStyleDeclaration();
|
|
430
|
+
test.expect(1);
|
|
431
|
+
style.setProperty('fontSize', '12px');
|
|
432
|
+
test.equal(style.cssText, '', 'cssText is not empty');
|
|
433
|
+
test.done();
|
|
434
|
+
},
|
|
435
|
+
'Make sure casing is ignored in `.setProperty()`': function(test) {
|
|
436
|
+
var style = new cssstyle.CSSStyleDeclaration();
|
|
437
|
+
test.expect(2);
|
|
438
|
+
style.setProperty('FoNt-SiZe', '12px');
|
|
439
|
+
test.equal(style.fontSize, '12px', 'font-size: 12px');
|
|
440
|
+
test.equal(style.getPropertyValue('font-size'), '12px', 'font-size: 12px');
|
|
441
|
+
test.done();
|
|
442
|
+
},
|
|
443
|
+
'Support non string entries in border-spacing': function (test) {
|
|
444
|
+
var style = new cssstyle.CSSStyleDeclaration();
|
|
445
|
+
test.expect(1);
|
|
446
|
+
style.borderSpacing = 0;
|
|
447
|
+
test.equal(style.cssText, 'border-spacing: 0px;', 'border-spacing is not 0');
|
|
448
|
+
test.done();
|
|
404
449
|
}
|
|
405
450
|
};
|
package/.npmignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
node_module
|
package/scripts/run_tests.sh
DELETED