cssstyle 2.1.0 → 2.2.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.
@@ -56,6 +56,11 @@ CSSStyleDeclaration.prototype = {
56
56
  this.removeProperty(name);
57
57
  return;
58
58
  }
59
+ var isCustomProperty = name.indexOf('--') === 0;
60
+ if (isCustomProperty) {
61
+ this._setProperty(name, value, priority);
62
+ return;
63
+ }
59
64
  var lowercaseName = name.toLowerCase();
60
65
  if (!allProperties.has(lowercaseName) && !allExtraProperties.has(lowercaseName)) {
61
66
  return;
@@ -518,4 +518,33 @@ describe('CSSStyleDeclaration', () => {
518
518
  expect(0).toEqual(style.length);
519
519
  expect(undefined).toEqual(style[0]);
520
520
  });
521
+
522
+ test('getPropertyValue for custom properties in cssText', () => {
523
+ const style = new CSSStyleDeclaration();
524
+ style.cssText = '--foo: red';
525
+
526
+ expect(style.getPropertyValue('--foo')).toEqual('red');
527
+ });
528
+
529
+ test('getPropertyValue for custom properties with setProperty', () => {
530
+ const style = new CSSStyleDeclaration();
531
+ style.setProperty('--bar', 'blue');
532
+
533
+ expect(style.getPropertyValue('--bar')).toEqual('blue');
534
+ });
535
+
536
+ test('getPropertyValue for custom properties with object setter', () => {
537
+ const style = new CSSStyleDeclaration();
538
+ style['--baz'] = 'yellow';
539
+
540
+ expect(style.getPropertyValue('--baz')).toEqual('');
541
+ });
542
+
543
+ test('custom properties are case-sensitive', () => {
544
+ const style = new CSSStyleDeclaration();
545
+ style.cssText = '--fOo: purple';
546
+
547
+ expect(style.getPropertyValue('--foo')).toEqual('');
548
+ expect(style.getPropertyValue('--fOo')).toEqual('purple');
549
+ });
521
550
  });
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- // autogenerated - 1/20/2020
3
+ // autogenerated - 1/23/2020
4
4
 
5
5
  /*
6
6
  *
package/lib/properties.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- // autogenerated - 1/20/2020
3
+ // autogenerated - 1/23/2020
4
4
 
5
5
  /*
6
6
  *
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "CSSStyleDeclaration",
7
7
  "StyleSheet"
8
8
  ],
9
- "version": "2.1.0",
9
+ "version": "2.2.0",
10
10
  "homepage": "https://github.com/jsdom/cssstyle",
11
11
  "maintainers": [
12
12
  {