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 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 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.
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 = /^(\"[^\"]*\"|\'[^\']*\')$/;
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ module.exports.definition = {
4
+ set: function (v) {
5
+ this._setProperty('align-content', v);
6
+ },
7
+ get: function () {
8
+ return this.getPropertyValue('align-content');
9
+ },
10
+ enumerable: true,
11
+ configurable: true
12
+ };
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ module.exports.definition = {
4
+ set: function (v) {
5
+ this._setProperty('align-items', v);
6
+ },
7
+ get: function () {
8
+ return this.getPropertyValue('align-items');
9
+ },
10
+ enumerable: true,
11
+ configurable: true
12
+ };
@@ -10,6 +10,9 @@ var parse = function parse(v) {
10
10
  if (v === '' || v === null) {
11
11
  return undefined;
12
12
  }
13
+ if (v === 0) {
14
+ return "0px";
15
+ }
13
16
  if (v.toLowerCase() === 'inherit') {
14
17
  return v;
15
18
  }
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ module.exports.definition = {
4
+ set: function (v) {
5
+ this._setProperty('flex-direction', v);
6
+ },
7
+ get: function () {
8
+ return this.getPropertyValue('flex-direction');
9
+ },
10
+ enumerable: true,
11
+ configurable: true
12
+ };
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ module.exports.definition = {
4
+ set: function (v) {
5
+ this._setProperty('flex-flow', v);
6
+ },
7
+ get: function () {
8
+ return this.getPropertyValue('flex-flow');
9
+ },
10
+ enumerable: true,
11
+ configurable: true
12
+ };
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ module.exports.definition = {
4
+ set: function (v) {
5
+ this._setProperty('flex-wrap', v);
6
+ },
7
+ get: function () {
8
+ return this.getPropertyValue('flex-wrap');
9
+ },
10
+ enumerable: true,
11
+ configurable: true
12
+ };
@@ -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', parseMeasurement(v));
17
+ this._setProperty('height', parse(v));
8
18
  },
9
19
  get: function () {
10
20
  return this.getPropertyValue('height');
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ module.exports.definition = {
4
+ set: function (v) {
5
+ this._setProperty('justify-content', v);
6
+ },
7
+ get: function () {
8
+ return this.getPropertyValue('justify-content');
9
+ },
10
+ enumerable: true,
11
+ configurable: true
12
+ };
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ module.exports.definition = {
4
+ set: function (v) {
5
+ this._setProperty('transform', v);
6
+ },
7
+ get: function () {
8
+ return this.getPropertyValue('transform');
9
+ },
10
+ enumerable: true,
11
+ configurable: true
12
+ };
@@ -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', parseMeasurement(v));
17
+ this._setProperty('width', parse(v));
8
18
  },
9
19
  get: function () {
10
20
  return this.getPropertyValue('width');