cssstyle 0.2.35 → 1.0.0
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 +1 -1
- 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/height.js +11 -1
- package/lib/properties/justifyContent.js +12 -0
- package/lib/properties/transform.js +12 -0
- package/lib/properties/width.js +11 -1
- package/lib/properties.js +5941 -1129
- package/package.json +52 -30
- package/scripts/generate_properties.js +283 -14
- package/tests/tests.js +38 -0
- package/.npmignore +0 -1
- package/scripts/run_tests.sh +0 -4
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ CSSStyleDeclaration is a work-a-like to the CSSStyleDeclaration class in Nikita
|
|
|
6
6
|
|
|
7
7
|
Why not just issue a pull request?
|
|
8
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
|
|
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.
|
|
10
10
|
|
|
11
11
|
How do I test this code?
|
|
12
12
|
---
|
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))$/;
|
|
25
25
|
var percentRegEx = /^[\-+]?[0-9]*\.?[0-9]+%$/;
|
|
26
26
|
var urlRegEx = /^url\(\s*([^\)]*)\s*\)$/;
|
|
27
27
|
var stringRegEx = /^(\"[^\"]*\"|\'[^\']*\')$/;
|
package/lib/properties/height.js
CHANGED
|
@@ -2,9 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
var parseMeasurement = require('../parsers').parseMeasurement;
|
|
4
4
|
|
|
5
|
+
function parse(v) {
|
|
6
|
+
if (String(v).toLowerCase() === 'auto') {
|
|
7
|
+
return 'auto';
|
|
8
|
+
}
|
|
9
|
+
if (String(v).toLowerCase() === 'inherit') {
|
|
10
|
+
return 'inherit';
|
|
11
|
+
}
|
|
12
|
+
return parseMeasurement(v);
|
|
13
|
+
}
|
|
14
|
+
|
|
5
15
|
module.exports.definition = {
|
|
6
16
|
set: function (v) {
|
|
7
|
-
this._setProperty('height',
|
|
17
|
+
this._setProperty('height', parse(v));
|
|
8
18
|
},
|
|
9
19
|
get: function () {
|
|
10
20
|
return this.getPropertyValue('height');
|
package/lib/properties/width.js
CHANGED
|
@@ -2,9 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
var parseMeasurement = require('../parsers').parseMeasurement;
|
|
4
4
|
|
|
5
|
+
function parse(v) {
|
|
6
|
+
if (String(v).toLowerCase() === 'auto') {
|
|
7
|
+
return 'auto';
|
|
8
|
+
}
|
|
9
|
+
if (String(v).toLowerCase() === 'inherit') {
|
|
10
|
+
return 'inherit';
|
|
11
|
+
}
|
|
12
|
+
return parseMeasurement(v);
|
|
13
|
+
}
|
|
14
|
+
|
|
5
15
|
module.exports.definition = {
|
|
6
16
|
set: function (v) {
|
|
7
|
-
this._setProperty('width',
|
|
17
|
+
this._setProperty('width', parse(v));
|
|
8
18
|
},
|
|
9
19
|
get: function () {
|
|
10
20
|
return this.getPropertyValue('width');
|