cssstyle 5.2.0 → 5.3.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.
Files changed (88) hide show
  1. package/lib/CSSStyleDeclaration.js +250 -254
  2. package/lib/generated/allProperties.js +39 -1
  3. package/lib/generated/implementedProperties.js +2219 -80
  4. package/lib/generated/properties.js +5253 -1904
  5. package/lib/normalize.js +1417 -0
  6. package/lib/parsers.js +372 -389
  7. package/lib/properties/background.js +76 -63
  8. package/lib/properties/backgroundAttachment.js +37 -22
  9. package/lib/properties/backgroundClip.js +37 -22
  10. package/lib/properties/backgroundColor.js +35 -15
  11. package/lib/properties/backgroundImage.js +49 -19
  12. package/lib/properties/backgroundOrigin.js +37 -22
  13. package/lib/properties/backgroundPosition.js +145 -128
  14. package/lib/properties/backgroundRepeat.js +55 -48
  15. package/lib/properties/backgroundSize.js +86 -46
  16. package/lib/properties/border.js +139 -22
  17. package/lib/properties/borderBottom.js +137 -21
  18. package/lib/properties/borderBottomColor.js +41 -16
  19. package/lib/properties/borderBottomStyle.js +39 -30
  20. package/lib/properties/borderBottomWidth.js +49 -16
  21. package/lib/properties/borderCollapse.js +32 -8
  22. package/lib/properties/borderColor.js +96 -23
  23. package/lib/properties/borderLeft.js +137 -21
  24. package/lib/properties/borderLeftColor.js +41 -16
  25. package/lib/properties/borderLeftStyle.js +39 -30
  26. package/lib/properties/borderLeftWidth.js +49 -16
  27. package/lib/properties/borderRight.js +137 -21
  28. package/lib/properties/borderRightColor.js +41 -16
  29. package/lib/properties/borderRightStyle.js +39 -30
  30. package/lib/properties/borderRightWidth.js +49 -16
  31. package/lib/properties/borderSpacing.js +42 -25
  32. package/lib/properties/borderStyle.js +96 -34
  33. package/lib/properties/borderTop.js +131 -15
  34. package/lib/properties/borderTopColor.js +41 -16
  35. package/lib/properties/borderTopStyle.js +39 -30
  36. package/lib/properties/borderTopWidth.js +49 -16
  37. package/lib/properties/borderWidth.js +108 -23
  38. package/lib/properties/bottom.js +40 -12
  39. package/lib/properties/clear.js +32 -22
  40. package/lib/properties/clip.js +46 -32
  41. package/lib/properties/color.js +34 -13
  42. package/lib/properties/display.js +169 -179
  43. package/lib/properties/flex.js +137 -38
  44. package/lib/properties/flexBasis.js +43 -14
  45. package/lib/properties/flexGrow.js +42 -9
  46. package/lib/properties/flexShrink.js +42 -9
  47. package/lib/properties/float.js +32 -9
  48. package/lib/properties/floodColor.js +34 -13
  49. package/lib/properties/font.js +145 -44
  50. package/lib/properties/fontFamily.js +66 -67
  51. package/lib/properties/fontSize.js +43 -26
  52. package/lib/properties/fontStyle.js +42 -11
  53. package/lib/properties/fontVariant.js +52 -15
  54. package/lib/properties/fontWeight.js +47 -15
  55. package/lib/properties/height.js +40 -13
  56. package/lib/properties/left.js +40 -12
  57. package/lib/properties/lightingColor.js +34 -13
  58. package/lib/properties/lineHeight.js +45 -18
  59. package/lib/properties/margin.js +73 -36
  60. package/lib/properties/marginBottom.js +43 -19
  61. package/lib/properties/marginLeft.js +43 -19
  62. package/lib/properties/marginRight.js +43 -19
  63. package/lib/properties/marginTop.js +43 -19
  64. package/lib/properties/opacity.js +41 -28
  65. package/lib/properties/outlineColor.js +34 -13
  66. package/lib/properties/padding.js +71 -36
  67. package/lib/properties/paddingBottom.js +44 -21
  68. package/lib/properties/paddingLeft.js +44 -19
  69. package/lib/properties/paddingRight.js +44 -19
  70. package/lib/properties/paddingTop.js +44 -19
  71. package/lib/properties/right.js +40 -12
  72. package/lib/properties/stopColor.js +34 -13
  73. package/lib/properties/top.js +40 -12
  74. package/lib/properties/webkitBorderAfterColor.js +34 -13
  75. package/lib/properties/webkitBorderBeforeColor.js +34 -13
  76. package/lib/properties/webkitBorderEndColor.js +34 -13
  77. package/lib/properties/webkitBorderStartColor.js +34 -13
  78. package/lib/properties/webkitColumnRuleColor.js +34 -13
  79. package/lib/properties/webkitTapHighlightColor.js +34 -13
  80. package/lib/properties/webkitTextEmphasisColor.js +34 -13
  81. package/lib/properties/webkitTextFillColor.js +34 -13
  82. package/lib/properties/webkitTextStrokeColor.js +34 -13
  83. package/lib/properties/width.js +40 -13
  84. package/lib/{allWebkitProperties.js → utils/allExtraProperties.js} +42 -1
  85. package/lib/utils/propertyDescriptors.js +6 -3
  86. package/package.json +11 -10
  87. package/lib/allExtraProperties.js +0 -49
  88. package/lib/shorthandProperties.js +0 -21
@@ -2,28 +2,49 @@
2
2
 
3
3
  const parsers = require("../parsers");
4
4
 
5
- module.exports.parse = function parse(v) {
6
- const val = parsers.parseColor(v);
7
- if (val) {
8
- return val;
9
- }
10
- return parsers.parseKeyword(v);
11
- };
5
+ const property = "-webkit-border-after-color";
12
6
 
13
- module.exports.isValid = function isValid(v) {
14
- if (v === "" || typeof parsers.parseKeyword(v) === "string") {
15
- return true;
7
+ module.exports.parse = function parse(v, opt = {}) {
8
+ const { globalObject } = opt;
9
+ if (v === "") {
10
+ return v;
11
+ }
12
+ const value = parsers.parsePropertyValue(property, v, {
13
+ globalObject,
14
+ inArray: true
15
+ });
16
+ if (Array.isArray(value) && value.length === 1) {
17
+ const [{ name, type }] = value;
18
+ switch (type) {
19
+ case "GlobalKeyword": {
20
+ return name;
21
+ }
22
+ default: {
23
+ return parsers.parseColor(value);
24
+ }
25
+ }
26
+ } else if (typeof value === "string") {
27
+ return value;
16
28
  }
17
- return parsers.isValidColor(v);
18
29
  };
19
30
 
20
31
  module.exports.definition = {
21
32
  set(v) {
22
33
  v = parsers.prepareValue(v, this._global);
23
- this._setProperty("-webkit-border-after-color", module.exports.parse(v));
34
+ if (parsers.hasVarFunc(v)) {
35
+ this._setProperty(property, v);
36
+ } else {
37
+ const val = module.exports.parse(v, {
38
+ globalObject: this._global
39
+ });
40
+ if (typeof val === "string") {
41
+ const priority = this._priorities.get(property) ?? "";
42
+ this._setProperty(property, val, priority);
43
+ }
44
+ }
24
45
  },
25
46
  get() {
26
- return this.getPropertyValue("-webkit-border-after-color");
47
+ return this.getPropertyValue(property);
27
48
  },
28
49
  enumerable: true,
29
50
  configurable: true
@@ -2,28 +2,49 @@
2
2
 
3
3
  const parsers = require("../parsers");
4
4
 
5
- module.exports.parse = function parse(v) {
6
- const val = parsers.parseColor(v);
7
- if (val) {
8
- return val;
9
- }
10
- return parsers.parseKeyword(v);
11
- };
5
+ const property = "-webkit-border-before-color";
12
6
 
13
- module.exports.isValid = function isValid(v) {
14
- if (v === "" || typeof parsers.parseKeyword(v) === "string") {
15
- return true;
7
+ module.exports.parse = function parse(v, opt = {}) {
8
+ const { globalObject } = opt;
9
+ if (v === "") {
10
+ return v;
11
+ }
12
+ const value = parsers.parsePropertyValue(property, v, {
13
+ globalObject,
14
+ inArray: true
15
+ });
16
+ if (Array.isArray(value) && value.length === 1) {
17
+ const [{ name, type }] = value;
18
+ switch (type) {
19
+ case "GlobalKeyword": {
20
+ return name;
21
+ }
22
+ default: {
23
+ return parsers.parseColor(value);
24
+ }
25
+ }
26
+ } else if (typeof value === "string") {
27
+ return value;
16
28
  }
17
- return parsers.isValidColor(v);
18
29
  };
19
30
 
20
31
  module.exports.definition = {
21
32
  set(v) {
22
33
  v = parsers.prepareValue(v, this._global);
23
- this._setProperty("-webkit-border-before-color", module.exports.parse(v));
34
+ if (parsers.hasVarFunc(v)) {
35
+ this._setProperty(property, v);
36
+ } else {
37
+ const val = module.exports.parse(v, {
38
+ globalObject: this._global
39
+ });
40
+ if (typeof val === "string") {
41
+ const priority = this._priorities.get(property) ?? "";
42
+ this._setProperty(property, val, priority);
43
+ }
44
+ }
24
45
  },
25
46
  get() {
26
- return this.getPropertyValue("-webkit-border-before-color");
47
+ return this.getPropertyValue(property);
27
48
  },
28
49
  enumerable: true,
29
50
  configurable: true
@@ -2,28 +2,49 @@
2
2
 
3
3
  const parsers = require("../parsers");
4
4
 
5
- module.exports.parse = function parse(v) {
6
- const val = parsers.parseColor(v);
7
- if (val) {
8
- return val;
9
- }
10
- return parsers.parseKeyword(v);
11
- };
5
+ const property = "-webkit-border-end-color";
12
6
 
13
- module.exports.isValid = function isValid(v) {
14
- if (v === "" || typeof parsers.parseKeyword(v) === "string") {
15
- return true;
7
+ module.exports.parse = function parse(v, opt = {}) {
8
+ const { globalObject } = opt;
9
+ if (v === "") {
10
+ return v;
11
+ }
12
+ const value = parsers.parsePropertyValue(property, v, {
13
+ globalObject,
14
+ inArray: true
15
+ });
16
+ if (Array.isArray(value) && value.length === 1) {
17
+ const [{ name, type }] = value;
18
+ switch (type) {
19
+ case "GlobalKeyword": {
20
+ return name;
21
+ }
22
+ default: {
23
+ return parsers.parseColor(value);
24
+ }
25
+ }
26
+ } else if (typeof value === "string") {
27
+ return value;
16
28
  }
17
- return parsers.isValidColor(v);
18
29
  };
19
30
 
20
31
  module.exports.definition = {
21
32
  set(v) {
22
33
  v = parsers.prepareValue(v, this._global);
23
- this._setProperty("-webkit-border-end-color", module.exports.parse(v));
34
+ if (parsers.hasVarFunc(v)) {
35
+ this._setProperty(property, v);
36
+ } else {
37
+ const val = module.exports.parse(v, {
38
+ globalObject: this._global
39
+ });
40
+ if (typeof val === "string") {
41
+ const priority = this._priorities.get(property) ?? "";
42
+ this._setProperty(property, val, priority);
43
+ }
44
+ }
24
45
  },
25
46
  get() {
26
- return this.getPropertyValue("-webkit-border-end-color");
47
+ return this.getPropertyValue(property);
27
48
  },
28
49
  enumerable: true,
29
50
  configurable: true
@@ -2,28 +2,49 @@
2
2
 
3
3
  const parsers = require("../parsers");
4
4
 
5
- module.exports.parse = function parse(v) {
6
- const val = parsers.parseColor(v);
7
- if (val) {
8
- return val;
9
- }
10
- return parsers.parseKeyword(v);
11
- };
5
+ const property = "-webkit-border-start-color";
12
6
 
13
- module.exports.isValid = function isValid(v) {
14
- if (v === "" || typeof parsers.parseKeyword(v) === "string") {
15
- return true;
7
+ module.exports.parse = function parse(v, opt = {}) {
8
+ const { globalObject } = opt;
9
+ if (v === "") {
10
+ return v;
11
+ }
12
+ const value = parsers.parsePropertyValue(property, v, {
13
+ globalObject,
14
+ inArray: true
15
+ });
16
+ if (Array.isArray(value) && value.length === 1) {
17
+ const [{ name, type }] = value;
18
+ switch (type) {
19
+ case "GlobalKeyword": {
20
+ return name;
21
+ }
22
+ default: {
23
+ return parsers.parseColor(value);
24
+ }
25
+ }
26
+ } else if (typeof value === "string") {
27
+ return value;
16
28
  }
17
- return parsers.isValidColor(v);
18
29
  };
19
30
 
20
31
  module.exports.definition = {
21
32
  set(v) {
22
33
  v = parsers.prepareValue(v, this._global);
23
- this._setProperty("-webkit-border-start-color", module.exports.parse(v));
34
+ if (parsers.hasVarFunc(v)) {
35
+ this._setProperty(property, v);
36
+ } else {
37
+ const val = module.exports.parse(v, {
38
+ globalObject: this._global
39
+ });
40
+ if (typeof val === "string") {
41
+ const priority = this._priorities.get(property) ?? "";
42
+ this._setProperty(property, val, priority);
43
+ }
44
+ }
24
45
  },
25
46
  get() {
26
- return this.getPropertyValue("-webkit-border-start-color");
47
+ return this.getPropertyValue(property);
27
48
  },
28
49
  enumerable: true,
29
50
  configurable: true
@@ -2,28 +2,49 @@
2
2
 
3
3
  const parsers = require("../parsers");
4
4
 
5
- module.exports.parse = function parse(v) {
6
- const val = parsers.parseColor(v);
7
- if (val) {
8
- return val;
9
- }
10
- return parsers.parseKeyword(v);
11
- };
5
+ const property = "-webkit-column-rule-color";
12
6
 
13
- module.exports.isValid = function isValid(v) {
14
- if (v === "" || typeof parsers.parseKeyword(v) === "string") {
15
- return true;
7
+ module.exports.parse = function parse(v, opt = {}) {
8
+ const { globalObject } = opt;
9
+ if (v === "") {
10
+ return v;
11
+ }
12
+ const value = parsers.parsePropertyValue(property, v, {
13
+ globalObject,
14
+ inArray: true
15
+ });
16
+ if (Array.isArray(value) && value.length === 1) {
17
+ const [{ name, type }] = value;
18
+ switch (type) {
19
+ case "GlobalKeyword": {
20
+ return name;
21
+ }
22
+ default: {
23
+ return parsers.parseColor(value);
24
+ }
25
+ }
26
+ } else if (typeof value === "string") {
27
+ return value;
16
28
  }
17
- return parsers.isValidColor(v);
18
29
  };
19
30
 
20
31
  module.exports.definition = {
21
32
  set(v) {
22
33
  v = parsers.prepareValue(v, this._global);
23
- this._setProperty("-webkit-column-rule-color", module.exports.parse(v));
34
+ if (parsers.hasVarFunc(v)) {
35
+ this._setProperty(property, v);
36
+ } else {
37
+ const val = module.exports.parse(v, {
38
+ globalObject: this._global
39
+ });
40
+ if (typeof val === "string") {
41
+ const priority = this._priorities.get(property) ?? "";
42
+ this._setProperty(property, val, priority);
43
+ }
44
+ }
24
45
  },
25
46
  get() {
26
- return this.getPropertyValue("-webkit-column-rule-color");
47
+ return this.getPropertyValue(property);
27
48
  },
28
49
  enumerable: true,
29
50
  configurable: true
@@ -2,28 +2,49 @@
2
2
 
3
3
  const parsers = require("../parsers");
4
4
 
5
- module.exports.parse = function parse(v) {
6
- const val = parsers.parseColor(v);
7
- if (val) {
8
- return val;
9
- }
10
- return parsers.parseKeyword(v);
11
- };
5
+ const property = "-webkit-tap-highlight-color";
12
6
 
13
- module.exports.isValid = function isValid(v) {
14
- if (v === "" || typeof parsers.parseKeyword(v) === "string") {
15
- return true;
7
+ module.exports.parse = function parse(v, opt = {}) {
8
+ const { globalObject } = opt;
9
+ if (v === "") {
10
+ return v;
11
+ }
12
+ const value = parsers.parsePropertyValue(property, v, {
13
+ globalObject,
14
+ inArray: true
15
+ });
16
+ if (Array.isArray(value) && value.length === 1) {
17
+ const [{ name, type }] = value;
18
+ switch (type) {
19
+ case "GlobalKeyword": {
20
+ return name;
21
+ }
22
+ default: {
23
+ return parsers.parseColor(value);
24
+ }
25
+ }
26
+ } else if (typeof value === "string") {
27
+ return value;
16
28
  }
17
- return parsers.isValidColor(v);
18
29
  };
19
30
 
20
31
  module.exports.definition = {
21
32
  set(v) {
22
33
  v = parsers.prepareValue(v, this._global);
23
- this._setProperty("-webkit-tap-highlight-color", module.exports.parse(v));
34
+ if (parsers.hasVarFunc(v)) {
35
+ this._setProperty(property, v);
36
+ } else {
37
+ const val = module.exports.parse(v, {
38
+ globalObject: this._global
39
+ });
40
+ if (typeof val === "string") {
41
+ const priority = this._priorities.get(property) ?? "";
42
+ this._setProperty(property, val, priority);
43
+ }
44
+ }
24
45
  },
25
46
  get() {
26
- return this.getPropertyValue("-webkit-tap-highlight-color");
47
+ return this.getPropertyValue(property);
27
48
  },
28
49
  enumerable: true,
29
50
  configurable: true
@@ -2,28 +2,49 @@
2
2
 
3
3
  const parsers = require("../parsers");
4
4
 
5
- module.exports.parse = function parse(v) {
6
- const val = parsers.parseColor(v);
7
- if (val) {
8
- return val;
9
- }
10
- return parsers.parseKeyword(v);
11
- };
5
+ const property = "-webkit-text-emphasis-color";
12
6
 
13
- module.exports.isValid = function isValid(v) {
14
- if (v === "" || typeof parsers.parseKeyword(v) === "string") {
15
- return true;
7
+ module.exports.parse = function parse(v, opt = {}) {
8
+ const { globalObject } = opt;
9
+ if (v === "") {
10
+ return v;
11
+ }
12
+ const value = parsers.parsePropertyValue(property, v, {
13
+ globalObject,
14
+ inArray: true
15
+ });
16
+ if (Array.isArray(value) && value.length === 1) {
17
+ const [{ name, type }] = value;
18
+ switch (type) {
19
+ case "GlobalKeyword": {
20
+ return name;
21
+ }
22
+ default: {
23
+ return parsers.parseColor(value);
24
+ }
25
+ }
26
+ } else if (typeof value === "string") {
27
+ return value;
16
28
  }
17
- return parsers.isValidColor(v);
18
29
  };
19
30
 
20
31
  module.exports.definition = {
21
32
  set(v) {
22
33
  v = parsers.prepareValue(v, this._global);
23
- this._setProperty("-webkit-text-emphasis-color", module.exports.parse(v));
34
+ if (parsers.hasVarFunc(v)) {
35
+ this._setProperty(property, v);
36
+ } else {
37
+ const val = module.exports.parse(v, {
38
+ globalObject: this._global
39
+ });
40
+ if (typeof val === "string") {
41
+ const priority = this._priorities.get(property) ?? "";
42
+ this._setProperty(property, val, priority);
43
+ }
44
+ }
24
45
  },
25
46
  get() {
26
- return this.getPropertyValue("-webkit-text-emphasis-color");
47
+ return this.getPropertyValue(property);
27
48
  },
28
49
  enumerable: true,
29
50
  configurable: true
@@ -2,28 +2,49 @@
2
2
 
3
3
  const parsers = require("../parsers");
4
4
 
5
- module.exports.parse = function parse(v) {
6
- const val = parsers.parseColor(v);
7
- if (val) {
8
- return val;
9
- }
10
- return parsers.parseKeyword(v);
11
- };
5
+ const property = "-webkit-text-fill-color";
12
6
 
13
- module.exports.isValid = function isValid(v) {
14
- if (v === "" || typeof parsers.parseKeyword(v) === "string") {
15
- return true;
7
+ module.exports.parse = function parse(v, opt = {}) {
8
+ const { globalObject } = opt;
9
+ if (v === "") {
10
+ return v;
11
+ }
12
+ const value = parsers.parsePropertyValue(property, v, {
13
+ globalObject,
14
+ inArray: true
15
+ });
16
+ if (Array.isArray(value) && value.length === 1) {
17
+ const [{ name, type }] = value;
18
+ switch (type) {
19
+ case "GlobalKeyword": {
20
+ return name;
21
+ }
22
+ default: {
23
+ return parsers.parseColor(value);
24
+ }
25
+ }
26
+ } else if (typeof value === "string") {
27
+ return value;
16
28
  }
17
- return parsers.isValidColor(v);
18
29
  };
19
30
 
20
31
  module.exports.definition = {
21
32
  set(v) {
22
33
  v = parsers.prepareValue(v, this._global);
23
- this._setProperty("-webkit-text-fill-color", module.exports.parse(v));
34
+ if (parsers.hasVarFunc(v)) {
35
+ this._setProperty(property, v);
36
+ } else {
37
+ const val = module.exports.parse(v, {
38
+ globalObject: this._global
39
+ });
40
+ if (typeof val === "string") {
41
+ const priority = this._priorities.get(property) ?? "";
42
+ this._setProperty(property, val, priority);
43
+ }
44
+ }
24
45
  },
25
46
  get() {
26
- return this.getPropertyValue("-webkit-text-fill-color");
47
+ return this.getPropertyValue(property);
27
48
  },
28
49
  enumerable: true,
29
50
  configurable: true
@@ -2,28 +2,49 @@
2
2
 
3
3
  const parsers = require("../parsers");
4
4
 
5
- module.exports.parse = function parse(v) {
6
- const val = parsers.parseColor(v);
7
- if (val) {
8
- return val;
9
- }
10
- return parsers.parseKeyword(v);
11
- };
5
+ const property = "-webkit-text-stroke-color";
12
6
 
13
- module.exports.isValid = function isValid(v) {
14
- if (v === "" || typeof parsers.parseKeyword(v) === "string") {
15
- return true;
7
+ module.exports.parse = function parse(v, opt = {}) {
8
+ const { globalObject } = opt;
9
+ if (v === "") {
10
+ return v;
11
+ }
12
+ const value = parsers.parsePropertyValue(property, v, {
13
+ globalObject,
14
+ inArray: true
15
+ });
16
+ if (Array.isArray(value) && value.length === 1) {
17
+ const [{ name, type }] = value;
18
+ switch (type) {
19
+ case "GlobalKeyword": {
20
+ return name;
21
+ }
22
+ default: {
23
+ return parsers.parseColor(value);
24
+ }
25
+ }
26
+ } else if (typeof value === "string") {
27
+ return value;
16
28
  }
17
- return parsers.isValidColor(v);
18
29
  };
19
30
 
20
31
  module.exports.definition = {
21
32
  set(v) {
22
33
  v = parsers.prepareValue(v, this._global);
23
- this._setProperty("-webkit-text-stroke-color", module.exports.parse(v));
34
+ if (parsers.hasVarFunc(v)) {
35
+ this._setProperty(property, v);
36
+ } else {
37
+ const val = module.exports.parse(v, {
38
+ globalObject: this._global
39
+ });
40
+ if (typeof val === "string") {
41
+ const priority = this._priorities.get(property) ?? "";
42
+ this._setProperty(property, val, priority);
43
+ }
44
+ }
24
45
  },
25
46
  get() {
26
- return this.getPropertyValue("-webkit-text-stroke-color");
47
+ return this.getPropertyValue(property);
27
48
  },
28
49
  enumerable: true,
29
50
  configurable: true
@@ -2,29 +2,56 @@
2
2
 
3
3
  const parsers = require("../parsers");
4
4
 
5
- module.exports.parse = function parse(v) {
6
- const dim = parsers.parseMeasurement(v, true);
7
- if (dim) {
8
- return dim;
9
- }
10
- const keywords = ["auto", "min-content", "max-content", "fit-content"];
11
- return parsers.parseKeyword(v, keywords);
12
- };
5
+ const property = "width";
13
6
 
14
- module.exports.isValid = function isValid(v) {
7
+ module.exports.parse = function parse(v, opt = {}) {
8
+ const { globalObject } = opt;
15
9
  if (v === "") {
16
- return true;
10
+ return v;
11
+ }
12
+ const value = parsers.parsePropertyValue(property, v, {
13
+ globalObject,
14
+ inArray: true
15
+ });
16
+ if (Array.isArray(value) && value.length === 1) {
17
+ const [{ isNumber, name, type, value: itemValue }] = value;
18
+ switch (type) {
19
+ case "Calc": {
20
+ if (isNumber) {
21
+ return;
22
+ }
23
+ return `${name}(${itemValue})`;
24
+ }
25
+ case "GlobalKeyword":
26
+ case "Identifier": {
27
+ return name;
28
+ }
29
+ default: {
30
+ return parsers.parseLengthPercentage(value);
31
+ }
32
+ }
33
+ } else if (typeof value === "string") {
34
+ return value;
17
35
  }
18
- return typeof module.exports.parse(v) === "string";
19
36
  };
20
37
 
21
38
  module.exports.definition = {
22
39
  set(v) {
23
40
  v = parsers.prepareValue(v, this._global);
24
- this._setProperty("width", module.exports.parse(v));
41
+ if (parsers.hasVarFunc(v)) {
42
+ this._setProperty(property, v);
43
+ } else {
44
+ const val = module.exports.parse(v, {
45
+ globalObject: this._global
46
+ });
47
+ if (typeof val === "string") {
48
+ const priority = this._priorities.get(property) ?? "";
49
+ this._setProperty(property, val, priority);
50
+ }
51
+ }
25
52
  },
26
53
  get() {
27
- return this.getPropertyValue("width");
54
+ return this.getPropertyValue(property);
28
55
  },
29
56
  enumerable: true,
30
57
  configurable: true
@@ -5,7 +5,7 @@
5
5
  * current specifications or drafts, but are handled by browsers nevertheless.
6
6
  */
7
7
 
8
- module.exports = [
8
+ const webkitProperties = [
9
9
  "background-composite",
10
10
  "border-after",
11
11
  "border-after-color",
@@ -112,3 +112,44 @@ module.exports = [
112
112
  "wrap-shape-outside",
113
113
  "zoom"
114
114
  ].map((prop) => `-webkit-${prop}`);
115
+
116
+ module.exports = new Set([
117
+ "background-position-x",
118
+ "background-position-y",
119
+ "background-repeat-x",
120
+ "background-repeat-y",
121
+ "color-interpolation",
122
+ "color-profile",
123
+ "color-rendering",
124
+ "enable-background",
125
+ "glyph-orientation-horizontal",
126
+ "kerning",
127
+ "marker-offset",
128
+ "marks",
129
+ "pointer-events",
130
+ "shape-rendering",
131
+ "size",
132
+ "src",
133
+ "stop-color",
134
+ "stop-opacity",
135
+ "text-anchor",
136
+ "text-line-through",
137
+ "text-line-through-color",
138
+ "text-line-through-mode",
139
+ "text-line-through-style",
140
+ "text-line-through-width",
141
+ "text-overline",
142
+ "text-overline-color",
143
+ "text-overline-mode",
144
+ "text-overline-style",
145
+ "text-overline-width",
146
+ "text-rendering",
147
+ "text-underline",
148
+ "text-underline-color",
149
+ "text-underline-mode",
150
+ "text-underline-style",
151
+ "text-underline-width",
152
+ "unicode-range",
153
+ "vector-effect",
154
+ ...webkitProperties
155
+ ]);