cssstyle 1.2.0 → 1.2.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/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "CSSStyleDeclaration",
7
7
  "StyleSheet"
8
8
  ],
9
- "version": "1.2.0",
9
+ "version": "1.2.1",
10
10
  "homepage": "https://github.com/jsakas/CSSStyleDeclaration",
11
11
  "maintainers": [
12
12
  {
@@ -26,18 +26,6 @@
26
26
  "email": "fatfisz@gmail.com",
27
27
  "url": "https://fatfisz.com"
28
28
  },
29
- {
30
- "name": "Sampo Kivistö",
31
- "email": "sampo.kivisto@live.fi"
32
- },
33
- {
34
- "name": "Benny Powers",
35
- "email": "web@bennypowers.com"
36
- },
37
- {
38
- "name": "step-off",
39
- "email": "stepanoff@skbkontur.ru"
40
- },
41
29
  {
42
30
  "name": "Nikita Vasilyev",
43
31
  "email": "me@elv1s.ru"
@@ -77,9 +65,9 @@
77
65
  "generate": "run-p generate:*",
78
66
  "generate:implemented_properties": "node ./scripts/generate_implemented_properties.js",
79
67
  "generate:properties": "node ./scripts/generate_properties.js",
80
- "lint": "npm run generate && eslint .",
81
- "lint:fix": "eslint . --fix",
82
- "prepublishOnly": "npm run test-ci",
68
+ "lint": "npm run generate && eslint . --max-warnings 0",
69
+ "lint:fix": "eslint . --fix --max-warnings 0",
70
+ "prepublishOnly": "test-ci",
83
71
  "test": "npm run generate && nodeunit tests",
84
72
  "test-ci": "npm run lint && npm run test"
85
73
  },
@@ -64,7 +64,7 @@ request(url, function(error, response, body) {
64
64
  out_file.write(
65
65
  "'use strict';\n\n// autogenerated - " +
66
66
  (date_today.getMonth() + 1 + '/' + date_today.getDate() + '/' + date_today.getFullYear()) +
67
- '\n\n',
67
+ '\n\n'
68
68
  );
69
69
  out_file.write('/*\n *\n * https://www.w3.org/Style/CSS/all-properties.en.html\n */\n\n');
70
70
 
@@ -18,7 +18,7 @@ var date_today = new Date();
18
18
  out_file.write(
19
19
  "'use strict';\n\n// autogenerated - " +
20
20
  (date_today.getMonth() + 1 + '/' + date_today.getDate() + '/' + date_today.getFullYear()) +
21
- '\n\n',
21
+ '\n\n'
22
22
  );
23
23
  out_file.write('/*\n *\n * https://www.w3.org/Style/CSS/all-properties.en.html\n */\n\n');
24
24
 
@@ -27,9 +27,9 @@ statements.push(
27
27
  t.variableDeclaration('var', [
28
28
  t.variableDeclarator(
29
29
  t.identifier('implementedProperties'),
30
- t.newExpression(t.identifier('Set'), []),
30
+ t.newExpression(t.identifier('Set'), [])
31
31
  ),
32
- ]),
32
+ ])
33
33
  );
34
34
 
35
35
  dashedProperties.forEach(property => {
@@ -37,9 +37,9 @@ dashedProperties.forEach(property => {
37
37
  t.expressionStatement(
38
38
  t.callExpression(
39
39
  t.memberExpression(t.identifier('implementedProperties'), t.identifier('add')),
40
- [t.stringLiteral(property)],
41
- ),
42
- ),
40
+ [t.stringLiteral(property)]
41
+ )
42
+ )
43
43
  );
44
44
  });
45
45
 
@@ -48,9 +48,9 @@ statements.push(
48
48
  t.assignmentExpression(
49
49
  '=',
50
50
  t.memberExpression(t.identifier('module'), t.identifier('exports')),
51
- t.identifier('implementedProperties'),
52
- ),
53
- ),
51
+ t.identifier('implementedProperties')
52
+ )
53
+ )
54
54
  );
55
55
 
56
56
  out_file.write(generate(t.program(statements)).code + '\n');
@@ -30,7 +30,7 @@ var date_today = new Date();
30
30
  out_file.write(
31
31
  "'use strict';\n\n// autogenerated - " +
32
32
  (date_today.getMonth() + 1 + '/' + date_today.getDate() + '/' + date_today.getFullYear()) +
33
- '\n\n',
33
+ '\n\n'
34
34
  );
35
35
  out_file.write('/*\n *\n * https://www.w3.org/Style/CSS/all-properties.en.html\n */\n\n');
36
36
 
@@ -92,7 +92,7 @@ function addFile(filename, dependencyPath) {
92
92
  dependencyPath
93
93
  .slice(dependencyPath.indexOf(filename))
94
94
  .concat([filename])
95
- .join(' -> '),
95
+ .join(' -> ')
96
96
  );
97
97
  }
98
98
  var file = parsedFilesByPath[filename];
@@ -119,7 +119,7 @@ var moduleExportsByPath = {};
119
119
  var statements = [];
120
120
  externalDependencies.forEach(function(filename, i) {
121
121
  var id = t.identifier(
122
- 'external_dependency_' + basename(filename, '.js').replace(/[^A-Za-z]/g, '') + '_' + i,
122
+ 'external_dependency_' + basename(filename, '.js').replace(/[^A-Za-z]/g, '') + '_' + i
123
123
  );
124
124
  moduleExportsByPath[filename] = { defaultExports: id };
125
125
  var relativePath = path.relative(path.resolve(__dirname + '/../lib'), filename);
@@ -130,9 +130,9 @@ externalDependencies.forEach(function(filename, i) {
130
130
  t.variableDeclaration('var', [
131
131
  t.variableDeclarator(
132
132
  id,
133
- t.callExpression(t.identifier('require'), [t.stringLiteral(relativePath)]),
133
+ t.callExpression(t.identifier('require'), [t.stringLiteral(relativePath)])
134
134
  ),
135
- ]),
135
+ ])
136
136
  );
137
137
  });
138
138
  function getRequireValue(node, file) {
@@ -205,7 +205,7 @@ parsedFiles.forEach(function(file) {
205
205
  path.node.declarations.forEach(function(declaration) {
206
206
  path.scope.rename(
207
207
  declaration.id.name,
208
- file.property + '_local_var_' + declaration.id.name,
208
+ file.property + '_local_var_' + declaration.id.name
209
209
  );
210
210
  });
211
211
  return;
@@ -236,7 +236,7 @@ parsedFiles.forEach(function(file) {
236
236
  var defaultExports = t.objectExpression(
237
237
  Object.keys(namedExports).map(function(name) {
238
238
  return t.objectProperty(t.identifier(name), namedExports[name]);
239
- }),
239
+ })
240
240
  );
241
241
  moduleExportsByPath[file.filename] = {
242
242
  namedExports: namedExports,
@@ -247,8 +247,8 @@ parsedFiles.forEach(function(file) {
247
247
  'var',
248
248
  Object.keys(namedExports).map(function(name) {
249
249
  return t.variableDeclarator(namedExports[name]);
250
- }),
251
- ),
250
+ })
251
+ )
252
252
  );
253
253
  statements.push.apply(statements, file.ast.program.body);
254
254
  });
@@ -258,18 +258,18 @@ parsedFiles.forEach(function(file) {
258
258
  propertyDefinitions.push(
259
259
  t.objectProperty(
260
260
  t.identifier(file.property),
261
- t.identifier(file.property + '_export_definition'),
262
- ),
261
+ t.identifier(file.property + '_export_definition')
262
+ )
263
263
  );
264
264
  if (file.property !== dashed) {
265
265
  propertyDefinitions.push(
266
- t.objectProperty(t.stringLiteral(dashed), t.identifier(file.property + '_export_definition')),
266
+ t.objectProperty(t.stringLiteral(dashed), t.identifier(file.property + '_export_definition'))
267
267
  );
268
268
  }
269
269
  });
270
270
  var definePropertiesCall = t.callExpression(
271
271
  t.memberExpression(t.identifier('Object'), t.identifier('defineProperties')),
272
- [t.identifier('prototype'), t.objectExpression(propertyDefinitions)],
272
+ [t.identifier('prototype'), t.objectExpression(propertyDefinitions)]
273
273
  );
274
274
  statements.push(
275
275
  t.expressionStatement(
@@ -279,10 +279,10 @@ statements.push(
279
279
  t.functionExpression(
280
280
  null,
281
281
  [t.identifier('prototype')],
282
- t.blockStatement([t.expressionStatement(definePropertiesCall)]),
283
- ),
284
- ),
285
- ),
282
+ t.blockStatement([t.expressionStatement(definePropertiesCall)])
283
+ )
284
+ )
285
+ )
286
286
  );
287
287
  out_file.write(generate(t.program(statements)).code + '\n');
288
288
  out_file.end(function(err) {
package/tests/tests.js CHANGED
@@ -9,7 +9,7 @@ var dashedProperties = [
9
9
  ];
10
10
  var allowedProperties = dashedProperties.map(dashedToCamelCase);
11
11
  var implementedProperties = Array.from(require('../lib/implementedProperties')).map(
12
- dashedToCamelCase,
12
+ dashedToCamelCase
13
13
  );
14
14
  var invalidProperties = implementedProperties.filter(function(property) {
15
15
  return !allowedProperties.includes(property);
@@ -22,7 +22,7 @@ module.exports = {
22
22
  invalidProperties.length === 0,
23
23
  invalidProperties.length +
24
24
  ' invalid properties implemented: ' +
25
- Array.from(invalidProperties).join(', '),
25
+ Array.from(invalidProperties).join(', ')
26
26
  );
27
27
  test.done();
28
28
  },
@@ -72,14 +72,14 @@ module.exports = {
72
72
  test.ok(4 === style.length, 'length is not 4');
73
73
  test.ok(
74
74
  'color: blue; background-color: red; width: 78%; height: 50vh;' === style.cssText,
75
- 'cssText is wrong',
75
+ 'cssText is wrong'
76
76
  );
77
77
  test.ok('blue' === style.getPropertyValue('color'), "getPropertyValue('color') failed");
78
78
  test.ok('color' === style.item(0), 'item(0) failed');
79
79
  test.ok('background-color' === style[1], 'style[1] failed');
80
80
  test.ok(
81
81
  'red' === style.backgroundColor,
82
- 'style.backgroundColor failed with "' + style.backgroundColor + '"',
82
+ 'style.backgroundColor failed with "' + style.backgroundColor + '"'
83
83
  );
84
84
  style.cssText = '';
85
85
  test.ok('' === style.cssText, 'cssText is not empty');
@@ -112,11 +112,11 @@ module.exports = {
112
112
  test.ok('blue' === style.backgroundColor, 'backgroundColor is not blue');
113
113
  test.ok(
114
114
  'url(http://www.example.com/some_img.jpg)' === style.backgroundImage,
115
- 'backgroundImage is wrong',
115
+ 'backgroundImage is wrong'
116
116
  );
117
117
  test.ok(
118
118
  'blue url(http://www.example.com/some_img.jpg)' === style.background,
119
- 'background is different',
119
+ 'background is different'
120
120
  );
121
121
  style.border = '0 solid black';
122
122
  test.ok('0px' === style.borderWidth, 'borderWidth is not 0px');
@@ -163,7 +163,7 @@ module.exports = {
163
163
  test.ok('0px' === style.borderRightWidth, 'borderRightWidth is not 0px');
164
164
  test.ok(
165
165
  'border-width: 0px;' === style.cssText,
166
- 'cssText is not "border-width: 0px", "' + style.cssText + '"',
166
+ 'cssText is not "border-width: 0px", "' + style.cssText + '"'
167
167
  );
168
168
  test.done();
169
169
  },
@@ -181,7 +181,7 @@ module.exports = {
181
181
  test.ok(4 === style.length, 'length is not 4');
182
182
  test.ok(
183
183
  'top: 0px; left: 0%; right: 5em; bottom: 12pt;' === style.cssText,
184
- 'text is not "top: 0px; left: 0%; right: 5em; bottom: 12pt;"',
184
+ 'text is not "top: 0px; left: 0%; right: 5em; bottom: 12pt;"'
185
185
  );
186
186
  test.done();
187
187
  },
@@ -204,12 +204,12 @@ module.exports = {
204
204
  style.clip = 'rect(0, 3Em, 2pt, 50%)';
205
205
  test.ok(
206
206
  'rect(0px, 3em, 2pt, 50%)' === style.clip,
207
- 'clip is not "rect(0px, 3em, 2pt, 50%)", "' + style.clip + '"',
207
+ 'clip is not "rect(0px, 3em, 2pt, 50%)", "' + style.clip + '"'
208
208
  );
209
209
  test.ok(2 === style.length, 'length is not 2');
210
210
  test.ok(
211
211
  'clear: both; clip: rect(0px, 3em, 2pt, 50%);' === style.cssText,
212
- 'cssText is not "clear: both; clip: rect(0px, 3em, 2pt, 50%);"',
212
+ 'cssText is not "clear: both; clip: rect(0px, 3em, 2pt, 50%);"'
213
213
  );
214
214
  test.done();
215
215
  },
@@ -227,7 +227,7 @@ module.exports = {
227
227
  style.color = 'hsla(0, 1%, 2%, 0.5)';
228
228
  test.ok(
229
229
  'hsla(0, 1%, 2%, 0.5)' === style.color,
230
- 'color is not hsla(0, 1%, 2%, 0.5) ' + style.color,
230
+ 'color is not hsla(0, 1%, 2%, 0.5) ' + style.color
231
231
  );
232
232
  style.color = 'hsl(0, 1%, 2%)';
233
233
  test.ok('hsl(0, 1%, 2%)' === style.color, 'color is not hsl(0, 1%, 2%) ' + style.color);
@@ -241,68 +241,68 @@ module.exports = {
241
241
  style.background = 'rgb(0, 0, 0) url(/something/somewhere.jpg)';
242
242
  test.ok(
243
243
  'rgb(0, 0, 0)' === style.backgroundColor,
244
- 'backgroundColor is not rgb(0, 0, 0): ' + style.backgroundColor,
244
+ 'backgroundColor is not rgb(0, 0, 0): ' + style.backgroundColor
245
245
  );
246
246
  test.ok(
247
247
  'url(/something/somewhere.jpg)' === style.backgroundImage,
248
- 'backgroundImage is not url(/something/somewhere.jpg): ' + style.backgroundImage,
248
+ 'backgroundImage is not url(/something/somewhere.jpg): ' + style.backgroundImage
249
249
  );
250
250
  test.ok(
251
251
  'background: rgb(0, 0, 0) url(/something/somewhere.jpg);' === style.cssText,
252
- 'cssText is not correct: ' + style.cssText,
252
+ 'cssText is not correct: ' + style.cssText
253
253
  );
254
254
  style = new cssstyle.CSSStyleDeclaration();
255
255
  style.border = ' 1px solid black ';
256
256
  test.ok(
257
257
  '1px solid black' === style.border,
258
- 'multiple spaces not properly parsed: ' + style.border,
258
+ 'multiple spaces not properly parsed: ' + style.border
259
259
  );
260
260
  test.done();
261
261
  },
262
262
  'Setting shorthand properties to an empty string should clear all dependent properties': function(
263
- test,
263
+ test
264
264
  ) {
265
265
  var style = new cssstyle.CSSStyleDeclaration();
266
266
  test.expect(2);
267
267
  style.borderWidth = '1px';
268
268
  test.ok(
269
269
  'border-width: 1px;' === style.cssText,
270
- 'cssText is not "border-width: 1px;": ' + style.cssText,
270
+ 'cssText is not "border-width: 1px;": ' + style.cssText
271
271
  );
272
272
  style.border = '';
273
273
  test.ok('' === style.cssText, 'cssText is not "": ' + style.cssText);
274
274
  test.done();
275
275
  },
276
276
  'Setting implicit properties to an empty string should clear all dependent properties': function(
277
- test,
277
+ test
278
278
  ) {
279
279
  var style = new cssstyle.CSSStyleDeclaration();
280
280
  test.expect(2);
281
281
  style.borderTopWidth = '1px';
282
282
  test.ok(
283
283
  'border-top-width: 1px;' === style.cssText,
284
- 'cssText is not "border-top-width: 1px;": ' + style.cssText,
284
+ 'cssText is not "border-top-width: 1px;": ' + style.cssText
285
285
  );
286
286
  style.borderWidth = '';
287
287
  test.ok('' === style.cssText, 'cssText is not "": ' + style.cssText);
288
288
  test.done();
289
289
  },
290
290
  'Setting a shorthand property, whose shorthands are implicit properties, to an empty string should clear all dependent properties': function(
291
- test,
291
+ test
292
292
  ) {
293
293
  var style = new cssstyle.CSSStyleDeclaration();
294
294
  test.expect(4);
295
295
  style.borderTopWidth = '1px';
296
296
  test.ok(
297
297
  'border-top-width: 1px;' === style.cssText,
298
- 'cssText is not "border-top-width: 1px;": ' + style.cssText,
298
+ 'cssText is not "border-top-width: 1px;": ' + style.cssText
299
299
  );
300
300
  style.border = '';
301
301
  test.ok('' === style.cssText, 'cssText is not "": ' + style.cssText);
302
302
  style.borderTop = '1px solid black';
303
303
  test.ok(
304
304
  'border-top: 1px solid black;' === style.cssText,
305
- 'cssText is not "border-top: 1px solid black;": ' + style.cssText,
305
+ 'cssText is not "border-top: 1px solid black;": ' + style.cssText
306
306
  );
307
307
  style.border = '';
308
308
  test.ok('' === style.cssText, 'cssText is not "": ' + style.cssText);
@@ -314,21 +314,21 @@ module.exports = {
314
314
  style.borderTopWidth = '1px';
315
315
  test.ok(
316
316
  'border-top-width: 1px;' === style.cssText,
317
- 'cssText is not "border-top-width: 1px;": ' + style.cssText,
317
+ 'cssText is not "border-top-width: 1px;": ' + style.cssText
318
318
  );
319
319
  style.border = 'none';
320
320
  test.ok('' === style.cssText, 'cssText is not "": ' + style.cssText);
321
321
  style.borderTopWidth = '1px';
322
322
  test.ok(
323
323
  'border-top-width: 1px;' === style.cssText,
324
- 'cssText is not "border-top-width: 1px;": ' + style.cssText,
324
+ 'cssText is not "border-top-width: 1px;": ' + style.cssText
325
325
  );
326
326
  style.borderTopStyle = 'none';
327
327
  test.ok('' === style.cssText, 'cssText is not "": ' + style.cssText);
328
328
  style.borderTopWidth = '1px';
329
329
  test.ok(
330
330
  'border-top-width: 1px;' === style.cssText,
331
- 'cssText is not "border-top-width: 1px;": ' + style.cssText,
331
+ 'cssText is not "border-top-width: 1px;": ' + style.cssText
332
332
  );
333
333
  style.borderTop = 'none';
334
334
  test.ok('' === style.cssText, 'cssText is not "": ' + style.cssText);
@@ -336,12 +336,12 @@ module.exports = {
336
336
  style.borderLeftWidth = '1px';
337
337
  test.ok(
338
338
  'border-top-width: 1px; border-left-width: 1px;' === style.cssText,
339
- 'cssText is not "border-top-width: 1px; border-left-width: 1px;": ' + style.cssText,
339
+ 'cssText is not "border-top-width: 1px; border-left-width: 1px;": ' + style.cssText
340
340
  );
341
341
  style.borderTop = 'none';
342
342
  test.ok(
343
343
  'border-left-width: 1px;' === style.cssText,
344
- 'cssText is not "border-left-width: 1px;": ' + style.cssText,
344
+ 'cssText is not "border-left-width: 1px;": ' + style.cssText
345
345
  );
346
346
  test.done();
347
347
  },
@@ -353,25 +353,25 @@ module.exports = {
353
353
  test.done();
354
354
  },
355
355
  'Setting values implicit and shorthand properties via cssText and setProperty should propagate to dependent properties': function(
356
- test,
356
+ test
357
357
  ) {
358
358
  var style = new cssstyle.CSSStyleDeclaration();
359
359
  test.expect(4);
360
360
  style.cssText = 'border: 1px solid black;';
361
361
  test.ok(
362
362
  'border: 1px solid black;' === style.cssText,
363
- 'cssText is not "border: 1px solid black;": ' + style.cssText,
363
+ 'cssText is not "border: 1px solid black;": ' + style.cssText
364
364
  );
365
365
  test.ok(
366
366
  '1px solid black' === style.borderTop,
367
- 'borderTop is not "1px solid black": ' + style.borderTop,
367
+ 'borderTop is not "1px solid black": ' + style.borderTop
368
368
  );
369
369
  style.border = '';
370
370
  test.ok('' === style.cssText, 'cssText is not "": ' + style.cssText);
371
371
  style.setProperty('border', '1px solid black');
372
372
  test.ok(
373
373
  'border: 1px solid black;' === style.cssText,
374
- 'cssText is not "border: 1px solid black;": ' + style.cssText,
374
+ 'cssText is not "border: 1px solid black;": ' + style.cssText
375
375
  );
376
376
  test.done();
377
377
  },
@@ -381,7 +381,7 @@ module.exports = {
381
381
  style.setProperty('opacity', 0.75);
382
382
  test.ok(
383
383
  'opacity: 0.75;' === style.cssText,
384
- 'cssText is not "opacity: 0.75;": ' + style.cssText,
384
+ 'cssText is not "opacity: 0.75;": ' + style.cssText
385
385
  );
386
386
  style.opacity = '0.50';
387
387
  test.ok('opacity: 0.5;' === style.cssText, 'cssText is not "opacity: 0.5;": ' + style.cssText);
@@ -486,17 +486,17 @@ module.exports = {
486
486
  style.backgroundImage = 'url(http://some/url/here1.png)';
487
487
  test.ok(
488
488
  'url(http://some/url/here1.png)' === style.backgroundImage,
489
- "background-image wasn't url(http://some/url/here1.png): " + style.backgroundImage,
489
+ "background-image wasn't url(http://some/url/here1.png): " + style.backgroundImage
490
490
  );
491
491
  style.backgroundImage = "url('http://some/url/here2.png')";
492
492
  test.ok(
493
493
  'url(http://some/url/here2.png)' === style.backgroundImage,
494
- "background-image wasn't url(http://some/url/here2.png): " + style.backgroundImage,
494
+ "background-image wasn't url(http://some/url/here2.png): " + style.backgroundImage
495
495
  );
496
496
  style.backgroundImage = 'url("http://some/url/here3.png")';
497
497
  test.ok(
498
498
  'url(http://some/url/here3.png)' === style.backgroundImage,
499
- "background-image wasn't url(http://some/url/here3.png): " + style.backgroundImage,
499
+ "background-image wasn't url(http://some/url/here3.png): " + style.backgroundImage
500
500
  );
501
501
  test.done();
502
502
  },
@@ -616,7 +616,7 @@ module.exports = {
616
616
  test.equal(
617
617
  style.getPropertyValue('flex-basis'),
618
618
  'auto',
619
- 'flex-basis is not `auto` if flex: none;',
619
+ 'flex-basis is not `auto` if flex: none;'
620
620
  );
621
621
  style.removeProperty('flex');
622
622
  style.removeProperty('flex-basis');
@@ -626,12 +626,12 @@ module.exports = {
626
626
  test.equal(
627
627
  style.getPropertyValue('flex-shrink'),
628
628
  '',
629
- 'flex-shrink is not empty if flex: auto;',
629
+ 'flex-shrink is not empty if flex: auto;'
630
630
  );
631
631
  test.equal(
632
632
  style.getPropertyValue('flex-basis'),
633
633
  'auto',
634
- 'flex-basis is not `auto` if flex: auto;',
634
+ 'flex-basis is not `auto` if flex: auto;'
635
635
  );
636
636
  style.removeProperty('flex');
637
637