cssstyle 2.3.0 → 3.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/CSSStyleDeclaration.js +18 -18
- package/lib/CSSStyleDeclaration.test.js +6 -6
- package/lib/allProperties.js +66 -9
- package/lib/allWebkitProperties.js +1 -1
- package/lib/implementedProperties.js +1 -1
- package/lib/parsers.js +21 -20
- package/lib/properties/azimuth.js +3 -6
- package/lib/properties/backgroundAttachment.js +2 -2
- package/lib/properties/backgroundColor.js +2 -2
- package/lib/properties/backgroundImage.js +2 -2
- package/lib/properties/backgroundPosition.js +3 -3
- package/lib/properties/backgroundRepeat.js +2 -2
- package/lib/properties/border.js +1 -1
- package/lib/properties/borderBottomColor.js +2 -2
- package/lib/properties/borderBottomStyle.js +2 -2
- package/lib/properties/borderBottomWidth.js +2 -2
- package/lib/properties/borderCollapse.js +2 -2
- package/lib/properties/borderColor.js +2 -2
- package/lib/properties/borderLeftColor.js +2 -2
- package/lib/properties/borderLeftStyle.js +2 -2
- package/lib/properties/borderLeftWidth.js +2 -2
- package/lib/properties/borderRightColor.js +2 -2
- package/lib/properties/borderRightStyle.js +2 -2
- package/lib/properties/borderRightWidth.js +2 -2
- package/lib/properties/borderSpacing.js +3 -3
- package/lib/properties/borderStyle.js +2 -2
- package/lib/properties/borderTopColor.js +2 -2
- package/lib/properties/borderTopStyle.js +2 -2
- package/lib/properties/borderTopWidth.js +2 -2
- package/lib/properties/borderWidth.js +2 -2
- package/lib/properties/bottom.js +2 -2
- package/lib/properties/clear.js +2 -2
- package/lib/properties/clip.js +4 -4
- package/lib/properties/color.js +2 -2
- package/lib/properties/cssFloat.js +2 -2
- package/lib/properties/flex.js +2 -4
- package/lib/properties/flexBasis.js +2 -2
- package/lib/properties/flexGrow.js +2 -2
- package/lib/properties/flexShrink.js +2 -2
- package/lib/properties/float.js +2 -2
- package/lib/properties/floodColor.js +2 -2
- package/lib/properties/font.js +1 -1
- package/lib/properties/fontFamily.js +2 -2
- package/lib/properties/fontSize.js +4 -4
- package/lib/properties/fontStyle.js +3 -3
- package/lib/properties/fontVariant.js +2 -2
- package/lib/properties/fontWeight.js +2 -2
- package/lib/properties/height.js +2 -2
- package/lib/properties/left.js +2 -2
- package/lib/properties/lightingColor.js +2 -2
- package/lib/properties/lineHeight.js +2 -2
- package/lib/properties/margin.js +6 -6
- package/lib/properties/marginBottom.js +1 -1
- package/lib/properties/marginLeft.js +1 -1
- package/lib/properties/marginRight.js +1 -1
- package/lib/properties/marginTop.js +1 -1
- package/lib/properties/opacity.js +2 -2
- package/lib/properties/outlineColor.js +2 -2
- package/lib/properties/padding.js +6 -6
- package/lib/properties/paddingBottom.js +1 -1
- package/lib/properties/paddingLeft.js +1 -1
- package/lib/properties/paddingRight.js +1 -1
- package/lib/properties/paddingTop.js +1 -1
- package/lib/properties/right.js +2 -2
- package/lib/properties/stopColor.js +2 -2
- package/lib/properties/textLineThroughColor.js +2 -2
- package/lib/properties/textOverlineColor.js +2 -2
- package/lib/properties/textUnderlineColor.js +2 -2
- package/lib/properties/top.js +2 -2
- package/lib/properties/webkitBorderAfterColor.js +2 -2
- package/lib/properties/webkitBorderBeforeColor.js +2 -2
- package/lib/properties/webkitBorderEndColor.js +2 -2
- package/lib/properties/webkitBorderStartColor.js +2 -2
- package/lib/properties/webkitColumnRuleColor.js +2 -2
- package/lib/properties/webkitMatchNearestMailBlockquoteColor.js +2 -2
- package/lib/properties/webkitTapHighlightColor.js +2 -2
- package/lib/properties/webkitTextEmphasisColor.js +2 -2
- package/lib/properties/webkitTextFillColor.js +2 -2
- package/lib/properties/webkitTextStrokeColor.js +2 -2
- package/lib/properties/width.js +2 -2
- package/lib/properties.js +1 -1
- package/lib/utils/getBasicPropertyDescriptor.js +2 -2
- package/package.json +15 -15
package/README.md
CHANGED
|
@@ -10,6 +10,6 @@ A Node JS implementation of the CSS Object Model [CSSStyleDeclaration interface]
|
|
|
10
10
|
|
|
11
11
|
This package is an extension of the CSSStyleDeclaration class in Nikita Vasilyev's [CSSOM](https://github.com/NV/CSSOM) with added support for CSS 2 & 3 properties. The primary use case is for testing browser code in a Node environment.
|
|
12
12
|
|
|
13
|
-
It was originally created by Chad Walker, it is now
|
|
13
|
+
It was originally created by Chad Walker, it is now maintained by the jsdom community.
|
|
14
14
|
|
|
15
15
|
Bug reports and pull requests are welcome.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* https://github.com/NV/CSSOM
|
|
4
4
|
********************************************************************/
|
|
5
5
|
'use strict';
|
|
6
|
-
var CSSOM = require('cssom');
|
|
6
|
+
var CSSOM = require('rrweb-cssom');
|
|
7
7
|
var allProperties = require('./allProperties');
|
|
8
8
|
var allExtraProperties = require('./allExtraProperties');
|
|
9
9
|
var implementedProperties = require('./implementedProperties');
|
|
@@ -20,7 +20,7 @@ var CSSStyleDeclaration = function CSSStyleDeclaration(onChangeCallback) {
|
|
|
20
20
|
this._length = 0;
|
|
21
21
|
this._onChange =
|
|
22
22
|
onChangeCallback ||
|
|
23
|
-
function() {
|
|
23
|
+
function () {
|
|
24
24
|
return;
|
|
25
25
|
};
|
|
26
26
|
};
|
|
@@ -34,7 +34,7 @@ CSSStyleDeclaration.prototype = {
|
|
|
34
34
|
* @return {string} the value of the property if it has been explicitly set for this declaration block.
|
|
35
35
|
* Returns the empty string if the property has not been set.
|
|
36
36
|
*/
|
|
37
|
-
getPropertyValue: function(name) {
|
|
37
|
+
getPropertyValue: function (name) {
|
|
38
38
|
if (!this._values.hasOwnProperty(name)) {
|
|
39
39
|
return '';
|
|
40
40
|
}
|
|
@@ -48,7 +48,7 @@ CSSStyleDeclaration.prototype = {
|
|
|
48
48
|
* @param {string} [priority=null] "important" or null
|
|
49
49
|
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-setProperty
|
|
50
50
|
*/
|
|
51
|
-
setProperty: function(name, value, priority) {
|
|
51
|
+
setProperty: function (name, value, priority) {
|
|
52
52
|
if (value === undefined) {
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
@@ -69,7 +69,7 @@ CSSStyleDeclaration.prototype = {
|
|
|
69
69
|
this[lowercaseName] = value;
|
|
70
70
|
this._importants[lowercaseName] = priority;
|
|
71
71
|
},
|
|
72
|
-
_setProperty: function(name, value, priority) {
|
|
72
|
+
_setProperty: function (name, value, priority) {
|
|
73
73
|
if (value === undefined) {
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
@@ -101,7 +101,7 @@ CSSStyleDeclaration.prototype = {
|
|
|
101
101
|
* @return {string} the value of the property if it has been explicitly set for this declaration block.
|
|
102
102
|
* Returns the empty string if the property has not been set or the property name does not correspond to a known CSS property.
|
|
103
103
|
*/
|
|
104
|
-
removeProperty: function(name) {
|
|
104
|
+
removeProperty: function (name) {
|
|
105
105
|
if (!this._values.hasOwnProperty(name)) {
|
|
106
106
|
return '';
|
|
107
107
|
}
|
|
@@ -129,11 +129,11 @@ CSSStyleDeclaration.prototype = {
|
|
|
129
129
|
*
|
|
130
130
|
* @param {String} name
|
|
131
131
|
*/
|
|
132
|
-
getPropertyPriority: function(name) {
|
|
132
|
+
getPropertyPriority: function (name) {
|
|
133
133
|
return this._importants[name] || '';
|
|
134
134
|
},
|
|
135
135
|
|
|
136
|
-
getPropertyCSSValue: function() {
|
|
136
|
+
getPropertyCSSValue: function () {
|
|
137
137
|
//FIXME
|
|
138
138
|
return;
|
|
139
139
|
},
|
|
@@ -143,12 +143,12 @@ CSSStyleDeclaration.prototype = {
|
|
|
143
143
|
* element.style.getPropertyShorthand("overflow-x")
|
|
144
144
|
* -> "overflow"
|
|
145
145
|
*/
|
|
146
|
-
getPropertyShorthand: function() {
|
|
146
|
+
getPropertyShorthand: function () {
|
|
147
147
|
//FIXME
|
|
148
148
|
return;
|
|
149
149
|
},
|
|
150
150
|
|
|
151
|
-
isPropertyImplicit: function() {
|
|
151
|
+
isPropertyImplicit: function () {
|
|
152
152
|
//FIXME
|
|
153
153
|
return;
|
|
154
154
|
},
|
|
@@ -156,7 +156,7 @@ CSSStyleDeclaration.prototype = {
|
|
|
156
156
|
/**
|
|
157
157
|
* http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-item
|
|
158
158
|
*/
|
|
159
|
-
item: function(index) {
|
|
159
|
+
item: function (index) {
|
|
160
160
|
index = parseInt(index, 10);
|
|
161
161
|
if (index < 0 || index >= this._length) {
|
|
162
162
|
return '';
|
|
@@ -167,7 +167,7 @@ CSSStyleDeclaration.prototype = {
|
|
|
167
167
|
|
|
168
168
|
Object.defineProperties(CSSStyleDeclaration.prototype, {
|
|
169
169
|
cssText: {
|
|
170
|
-
get: function() {
|
|
170
|
+
get: function () {
|
|
171
171
|
var properties = [];
|
|
172
172
|
var i;
|
|
173
173
|
var name;
|
|
@@ -184,7 +184,7 @@ Object.defineProperties(CSSStyleDeclaration.prototype, {
|
|
|
184
184
|
}
|
|
185
185
|
return properties.join(' ');
|
|
186
186
|
},
|
|
187
|
-
set: function(value) {
|
|
187
|
+
set: function (value) {
|
|
188
188
|
var i;
|
|
189
189
|
this._values = {};
|
|
190
190
|
Array.prototype.splice.call(this, 0, this._length);
|
|
@@ -212,14 +212,14 @@ Object.defineProperties(CSSStyleDeclaration.prototype, {
|
|
|
212
212
|
configurable: true,
|
|
213
213
|
},
|
|
214
214
|
parentRule: {
|
|
215
|
-
get: function() {
|
|
215
|
+
get: function () {
|
|
216
216
|
return null;
|
|
217
217
|
},
|
|
218
218
|
enumerable: true,
|
|
219
219
|
configurable: true,
|
|
220
220
|
},
|
|
221
221
|
length: {
|
|
222
|
-
get: function() {
|
|
222
|
+
get: function () {
|
|
223
223
|
return this._length;
|
|
224
224
|
},
|
|
225
225
|
/**
|
|
@@ -227,7 +227,7 @@ Object.defineProperties(CSSStyleDeclaration.prototype, {
|
|
|
227
227
|
* length. If the new length is more, it does nothing, the new indices
|
|
228
228
|
* will be undefined until set.
|
|
229
229
|
**/
|
|
230
|
-
set: function(value) {
|
|
230
|
+
set: function (value) {
|
|
231
231
|
var i;
|
|
232
232
|
for (i = value; i < this._length; i++) {
|
|
233
233
|
delete this[i];
|
|
@@ -241,7 +241,7 @@ Object.defineProperties(CSSStyleDeclaration.prototype, {
|
|
|
241
241
|
|
|
242
242
|
require('./properties')(CSSStyleDeclaration.prototype);
|
|
243
243
|
|
|
244
|
-
allProperties.forEach(function(property) {
|
|
244
|
+
allProperties.forEach(function (property) {
|
|
245
245
|
if (!implementedProperties.has(property)) {
|
|
246
246
|
var declaration = getBasicPropertyDescriptor(property);
|
|
247
247
|
Object.defineProperty(CSSStyleDeclaration.prototype, property, declaration);
|
|
@@ -249,7 +249,7 @@ allProperties.forEach(function(property) {
|
|
|
249
249
|
}
|
|
250
250
|
});
|
|
251
251
|
|
|
252
|
-
allExtraProperties.forEach(function(property) {
|
|
252
|
+
allExtraProperties.forEach(function (property) {
|
|
253
253
|
if (!implementedProperties.has(property)) {
|
|
254
254
|
var declaration = getBasicPropertyDescriptor(property);
|
|
255
255
|
Object.defineProperty(CSSStyleDeclaration.prototype, property, declaration);
|
|
@@ -10,7 +10,7 @@ var parsers = require('./parsers');
|
|
|
10
10
|
var dashedProperties = [...allProperties, ...allExtraProperties];
|
|
11
11
|
var allowedProperties = dashedProperties.map(parsers.dashedToCamelCase);
|
|
12
12
|
implementedProperties = Array.from(implementedProperties).map(parsers.dashedToCamelCase);
|
|
13
|
-
var invalidProperties = implementedProperties.filter(prop => !allowedProperties.includes(prop));
|
|
13
|
+
var invalidProperties = implementedProperties.filter((prop) => !allowedProperties.includes(prop));
|
|
14
14
|
|
|
15
15
|
describe('CSSStyleDeclaration', () => {
|
|
16
16
|
test('has only valid properties implemented', () => {
|
|
@@ -19,7 +19,7 @@ describe('CSSStyleDeclaration', () => {
|
|
|
19
19
|
|
|
20
20
|
test('has all properties', () => {
|
|
21
21
|
var style = new CSSStyleDeclaration();
|
|
22
|
-
allProperties.forEach(property => {
|
|
22
|
+
allProperties.forEach((property) => {
|
|
23
23
|
expect(style.__lookupGetter__(property)).toBeTruthy();
|
|
24
24
|
expect(style.__lookupSetter__(property)).toBeTruthy();
|
|
25
25
|
});
|
|
@@ -27,7 +27,7 @@ describe('CSSStyleDeclaration', () => {
|
|
|
27
27
|
|
|
28
28
|
test('has dashed properties', () => {
|
|
29
29
|
var style = new CSSStyleDeclaration();
|
|
30
|
-
dashedProperties.forEach(property => {
|
|
30
|
+
dashedProperties.forEach((property) => {
|
|
31
31
|
expect(style.__lookupGetter__(property)).toBeTruthy();
|
|
32
32
|
expect(style.__lookupSetter__(property)).toBeTruthy();
|
|
33
33
|
});
|
|
@@ -302,7 +302,7 @@ describe('CSSStyleDeclaration', () => {
|
|
|
302
302
|
test('padding and margin should set/clear shorthand properties', () => {
|
|
303
303
|
var style = new CSSStyleDeclaration();
|
|
304
304
|
var parts = ['Top', 'Right', 'Bottom', 'Left'];
|
|
305
|
-
var testParts = function(name, v, V) {
|
|
305
|
+
var testParts = function (name, v, V) {
|
|
306
306
|
style[name] = v;
|
|
307
307
|
for (var i = 0; i < 4; i++) {
|
|
308
308
|
var part = name + parts[i];
|
|
@@ -329,7 +329,7 @@ describe('CSSStyleDeclaration', () => {
|
|
|
329
329
|
test('padding and margin shorthands should set main properties', () => {
|
|
330
330
|
var style = new CSSStyleDeclaration();
|
|
331
331
|
var parts = ['Top', 'Right', 'Bottom', 'Left'];
|
|
332
|
-
var testParts = function(name, v, V) {
|
|
332
|
+
var testParts = function (name, v, V) {
|
|
333
333
|
var expected;
|
|
334
334
|
for (var i = 0; i < 4; i++) {
|
|
335
335
|
style[name] = v;
|
|
@@ -353,7 +353,7 @@ describe('CSSStyleDeclaration', () => {
|
|
|
353
353
|
});
|
|
354
354
|
|
|
355
355
|
test('onchange callback should be called when the csstext changes', () => {
|
|
356
|
-
var style = new CSSStyleDeclaration(function(cssText) {
|
|
356
|
+
var style = new CSSStyleDeclaration(function (cssText) {
|
|
357
357
|
expect(cssText).toEqual('opacity: 0;');
|
|
358
358
|
});
|
|
359
359
|
style.setProperty('opacity', 0);
|
package/lib/allProperties.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// autogenerated -
|
|
3
|
+
// autogenerated - 1/22/2023
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
*
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = new Set([
|
|
11
|
+
'-webkit-line-clamp',
|
|
12
|
+
'accent-color',
|
|
11
13
|
'align-content',
|
|
12
14
|
'align-items',
|
|
13
15
|
'align-self',
|
|
@@ -15,15 +17,20 @@ module.exports = new Set([
|
|
|
15
17
|
'all',
|
|
16
18
|
'animation',
|
|
17
19
|
'animation-delay',
|
|
20
|
+
'animation-delay-end',
|
|
21
|
+
'animation-delay-start',
|
|
18
22
|
'animation-direction',
|
|
19
23
|
'animation-duration',
|
|
20
24
|
'animation-fill-mode',
|
|
21
25
|
'animation-iteration-count',
|
|
22
26
|
'animation-name',
|
|
23
27
|
'animation-play-state',
|
|
28
|
+
'animation-range',
|
|
24
29
|
'animation-timing-function',
|
|
25
30
|
'appearance',
|
|
31
|
+
'aspect-ratio',
|
|
26
32
|
'azimuth',
|
|
33
|
+
'backface-visibility',
|
|
27
34
|
'background',
|
|
28
35
|
'background-attachment',
|
|
29
36
|
'background-blend-mode',
|
|
@@ -35,7 +42,8 @@ module.exports = new Set([
|
|
|
35
42
|
'background-repeat',
|
|
36
43
|
'background-size',
|
|
37
44
|
'baseline-shift',
|
|
38
|
-
'
|
|
45
|
+
'baseline-source',
|
|
46
|
+
'block-ellipsis',
|
|
39
47
|
'block-size',
|
|
40
48
|
'bookmark-label',
|
|
41
49
|
'bookmark-level',
|
|
@@ -134,7 +142,16 @@ module.exports = new Set([
|
|
|
134
142
|
'column-width',
|
|
135
143
|
'columns',
|
|
136
144
|
'contain',
|
|
145
|
+
'contain-intrinsic-block-size',
|
|
146
|
+
'contain-intrinsic-height',
|
|
147
|
+
'contain-intrinsic-inline-size',
|
|
148
|
+
'contain-intrinsic-size',
|
|
149
|
+
'contain-intrinsic-width',
|
|
150
|
+
'container',
|
|
151
|
+
'container-name',
|
|
152
|
+
'container-type',
|
|
137
153
|
'content',
|
|
154
|
+
'content-visibility',
|
|
138
155
|
'continue',
|
|
139
156
|
'counter-increment',
|
|
140
157
|
'counter-reset',
|
|
@@ -218,9 +235,9 @@ module.exports = new Set([
|
|
|
218
235
|
'image-orientation',
|
|
219
236
|
'image-rendering',
|
|
220
237
|
'image-resolution',
|
|
221
|
-
'initial-
|
|
222
|
-
'initial-
|
|
223
|
-
'initial-
|
|
238
|
+
'initial-letter',
|
|
239
|
+
'initial-letter-align',
|
|
240
|
+
'initial-letter-wrap',
|
|
224
241
|
'inline-size',
|
|
225
242
|
'inline-sizing',
|
|
226
243
|
'inset',
|
|
@@ -234,6 +251,7 @@ module.exports = new Set([
|
|
|
234
251
|
'justify-content',
|
|
235
252
|
'justify-items',
|
|
236
253
|
'justify-self',
|
|
254
|
+
'leading-trim',
|
|
237
255
|
'left',
|
|
238
256
|
'letter-spacing',
|
|
239
257
|
'lighting-color',
|
|
@@ -258,6 +276,7 @@ module.exports = new Set([
|
|
|
258
276
|
'margin-left',
|
|
259
277
|
'margin-right',
|
|
260
278
|
'margin-top',
|
|
279
|
+
'margin-trim',
|
|
261
280
|
'marker-side',
|
|
262
281
|
'mask',
|
|
263
282
|
'mask-border',
|
|
@@ -284,6 +303,7 @@ module.exports = new Set([
|
|
|
284
303
|
'min-block-size',
|
|
285
304
|
'min-height',
|
|
286
305
|
'min-inline-size',
|
|
306
|
+
'min-intrinsic-sizing',
|
|
287
307
|
'min-width',
|
|
288
308
|
'mix-blend-mode',
|
|
289
309
|
'nav-down',
|
|
@@ -293,15 +313,11 @@ module.exports = new Set([
|
|
|
293
313
|
'object-fit',
|
|
294
314
|
'object-position',
|
|
295
315
|
'offset',
|
|
296
|
-
'offset-after',
|
|
297
316
|
'offset-anchor',
|
|
298
|
-
'offset-before',
|
|
299
317
|
'offset-distance',
|
|
300
|
-
'offset-end',
|
|
301
318
|
'offset-path',
|
|
302
319
|
'offset-position',
|
|
303
320
|
'offset-rotate',
|
|
304
|
-
'offset-start',
|
|
305
321
|
'opacity',
|
|
306
322
|
'order',
|
|
307
323
|
'orphans',
|
|
@@ -311,7 +327,19 @@ module.exports = new Set([
|
|
|
311
327
|
'outline-style',
|
|
312
328
|
'outline-width',
|
|
313
329
|
'overflow',
|
|
330
|
+
'overflow-anchor',
|
|
314
331
|
'overflow-block',
|
|
332
|
+
'overflow-clip-margin',
|
|
333
|
+
'overflow-clip-margin-block',
|
|
334
|
+
'overflow-clip-margin-block-end',
|
|
335
|
+
'overflow-clip-margin-block-start',
|
|
336
|
+
'overflow-clip-margin-bottom',
|
|
337
|
+
'overflow-clip-margin-inline',
|
|
338
|
+
'overflow-clip-margin-inline-end',
|
|
339
|
+
'overflow-clip-margin-inline-start',
|
|
340
|
+
'overflow-clip-margin-left',
|
|
341
|
+
'overflow-clip-margin-right',
|
|
342
|
+
'overflow-clip-margin-top',
|
|
315
343
|
'overflow-inline',
|
|
316
344
|
'overflow-wrap',
|
|
317
345
|
'overflow-x',
|
|
@@ -334,6 +362,8 @@ module.exports = new Set([
|
|
|
334
362
|
'pause',
|
|
335
363
|
'pause-after',
|
|
336
364
|
'pause-before',
|
|
365
|
+
'perspective',
|
|
366
|
+
'perspective-origin',
|
|
337
367
|
'pitch',
|
|
338
368
|
'pitch-range',
|
|
339
369
|
'place-content',
|
|
@@ -341,6 +371,7 @@ module.exports = new Set([
|
|
|
341
371
|
'place-self',
|
|
342
372
|
'play-during',
|
|
343
373
|
'position',
|
|
374
|
+
'print-color-adjust',
|
|
344
375
|
'quotes',
|
|
345
376
|
'region-fragment',
|
|
346
377
|
'resize',
|
|
@@ -349,11 +380,14 @@ module.exports = new Set([
|
|
|
349
380
|
'rest-before',
|
|
350
381
|
'richness',
|
|
351
382
|
'right',
|
|
383
|
+
'rotate',
|
|
352
384
|
'row-gap',
|
|
353
385
|
'ruby-align',
|
|
354
386
|
'ruby-merge',
|
|
387
|
+
'ruby-overhang',
|
|
355
388
|
'ruby-position',
|
|
356
389
|
'running',
|
|
390
|
+
'scale',
|
|
357
391
|
'scroll-behavior',
|
|
358
392
|
'scroll-margin',
|
|
359
393
|
'scroll-margin-block',
|
|
@@ -380,6 +414,12 @@ module.exports = new Set([
|
|
|
380
414
|
'scroll-snap-align',
|
|
381
415
|
'scroll-snap-stop',
|
|
382
416
|
'scroll-snap-type',
|
|
417
|
+
'scroll-timeline',
|
|
418
|
+
'scroll-timeline-axis',
|
|
419
|
+
'scroll-timeline-name',
|
|
420
|
+
'scrollbar-color',
|
|
421
|
+
'scrollbar-gutter',
|
|
422
|
+
'scrollbar-width',
|
|
383
423
|
'shape-image-threshold',
|
|
384
424
|
'shape-inside',
|
|
385
425
|
'shape-margin',
|
|
@@ -404,10 +444,19 @@ module.exports = new Set([
|
|
|
404
444
|
'text-decoration',
|
|
405
445
|
'text-decoration-color',
|
|
406
446
|
'text-decoration-line',
|
|
447
|
+
'text-decoration-skip',
|
|
448
|
+
'text-decoration-skip-box',
|
|
449
|
+
'text-decoration-skip-ink',
|
|
450
|
+
'text-decoration-skip-inset',
|
|
451
|
+
'text-decoration-skip-self',
|
|
452
|
+
'text-decoration-skip-spaces',
|
|
407
453
|
'text-decoration-style',
|
|
454
|
+
'text-decoration-thickness',
|
|
455
|
+
'text-edge',
|
|
408
456
|
'text-emphasis',
|
|
409
457
|
'text-emphasis-color',
|
|
410
458
|
'text-emphasis-position',
|
|
459
|
+
'text-emphasis-skip',
|
|
411
460
|
'text-emphasis-style',
|
|
412
461
|
'text-group-align',
|
|
413
462
|
'text-indent',
|
|
@@ -419,20 +468,28 @@ module.exports = new Set([
|
|
|
419
468
|
'text-space-trim',
|
|
420
469
|
'text-spacing',
|
|
421
470
|
'text-transform',
|
|
471
|
+
'text-underline-offset',
|
|
422
472
|
'text-underline-position',
|
|
423
473
|
'text-wrap',
|
|
424
474
|
'top',
|
|
425
475
|
'transform',
|
|
426
476
|
'transform-box',
|
|
427
477
|
'transform-origin',
|
|
478
|
+
'transform-style',
|
|
428
479
|
'transition',
|
|
429
480
|
'transition-delay',
|
|
430
481
|
'transition-duration',
|
|
431
482
|
'transition-property',
|
|
432
483
|
'transition-timing-function',
|
|
484
|
+
'translate',
|
|
433
485
|
'unicode-bidi',
|
|
434
486
|
'user-select',
|
|
435
487
|
'vertical-align',
|
|
488
|
+
'view-timeline',
|
|
489
|
+
'view-timeline-axis',
|
|
490
|
+
'view-timeline-inset',
|
|
491
|
+
'view-timeline-name',
|
|
492
|
+
'view-transition-name',
|
|
436
493
|
'visibility',
|
|
437
494
|
'voice-balance',
|
|
438
495
|
'voice-duration',
|
package/lib/parsers.js
CHANGED
|
@@ -32,7 +32,8 @@ var colorRegEx1 = /^#([0-9a-fA-F]{3,4}){1,2}$/;
|
|
|
32
32
|
var colorRegEx2 = /^rgb\(([^)]*)\)$/;
|
|
33
33
|
var colorRegEx3 = /^rgba\(([^)]*)\)$/;
|
|
34
34
|
var calcRegEx = /^calc\(([^)]*)\)$/;
|
|
35
|
-
var colorRegEx4 =
|
|
35
|
+
var colorRegEx4 =
|
|
36
|
+
/^hsla?\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*(,\s*(-?\d+|-?\d*.\d+)\s*)?\)/;
|
|
36
37
|
var angleRegEx = /^([-+]?[0-9]*\.?[0-9]+)(deg|grad|rad)$/;
|
|
37
38
|
|
|
38
39
|
// This will return one of the above types based on the passed in string
|
|
@@ -448,7 +449,7 @@ exports.parseKeyword = function parseKeyword(val, valid_keywords) {
|
|
|
448
449
|
};
|
|
449
450
|
|
|
450
451
|
// utility to translate from border-width to borderWidth
|
|
451
|
-
var dashedToCamelCase = function(dashed) {
|
|
452
|
+
var dashedToCamelCase = function (dashed) {
|
|
452
453
|
var i;
|
|
453
454
|
var camel = '';
|
|
454
455
|
var nextCap = false;
|
|
@@ -468,7 +469,7 @@ var is_space = /\s/;
|
|
|
468
469
|
var opening_deliminators = ['"', "'", '('];
|
|
469
470
|
var closing_deliminators = ['"', "'", ')'];
|
|
470
471
|
// this splits on whitespace, but keeps quoted and parened parts together
|
|
471
|
-
var getParts = function(str) {
|
|
472
|
+
var getParts = function (str) {
|
|
472
473
|
var deliminator_stack = [];
|
|
473
474
|
var length = str.length;
|
|
474
475
|
var i;
|
|
@@ -521,7 +522,7 @@ exports.shorthandParser = function parse(v, shorthand_for) {
|
|
|
521
522
|
var obj = {};
|
|
522
523
|
var type = exports.valueType(v);
|
|
523
524
|
if (type === exports.TYPES.NULL_OR_EMPTY_STR) {
|
|
524
|
-
Object.keys(shorthand_for).forEach(function(property) {
|
|
525
|
+
Object.keys(shorthand_for).forEach(function (property) {
|
|
525
526
|
obj[property] = '';
|
|
526
527
|
});
|
|
527
528
|
return obj;
|
|
@@ -540,9 +541,9 @@ exports.shorthandParser = function parse(v, shorthand_for) {
|
|
|
540
541
|
}
|
|
541
542
|
var parts = getParts(v);
|
|
542
543
|
var valid = true;
|
|
543
|
-
parts.forEach(function(part, i) {
|
|
544
|
+
parts.forEach(function (part, i) {
|
|
544
545
|
var part_valid = false;
|
|
545
|
-
Object.keys(shorthand_for).forEach(function(property) {
|
|
546
|
+
Object.keys(shorthand_for).forEach(function (property) {
|
|
546
547
|
if (shorthand_for[property].isValid(part, i)) {
|
|
547
548
|
part_valid = true;
|
|
548
549
|
obj[property] = part;
|
|
@@ -556,14 +557,14 @@ exports.shorthandParser = function parse(v, shorthand_for) {
|
|
|
556
557
|
return obj;
|
|
557
558
|
};
|
|
558
559
|
|
|
559
|
-
exports.shorthandSetter = function(property, shorthand_for) {
|
|
560
|
-
return function(v) {
|
|
560
|
+
exports.shorthandSetter = function (property, shorthand_for) {
|
|
561
|
+
return function (v) {
|
|
561
562
|
var obj = exports.shorthandParser(v, shorthand_for);
|
|
562
563
|
if (obj === undefined) {
|
|
563
564
|
return;
|
|
564
565
|
}
|
|
565
566
|
//console.log('shorthandSetter for:', property, 'obj:', obj);
|
|
566
|
-
Object.keys(obj).forEach(function(subprop) {
|
|
567
|
+
Object.keys(obj).forEach(function (subprop) {
|
|
567
568
|
// in case subprop is an implicit property, this will clear
|
|
568
569
|
// *its* subpropertiesX
|
|
569
570
|
var camel = dashedToCamelCase(subprop);
|
|
@@ -576,7 +577,7 @@ exports.shorthandSetter = function(property, shorthand_for) {
|
|
|
576
577
|
this._values[subprop] = obj[subprop];
|
|
577
578
|
}
|
|
578
579
|
}, this);
|
|
579
|
-
Object.keys(shorthand_for).forEach(function(subprop) {
|
|
580
|
+
Object.keys(shorthand_for).forEach(function (subprop) {
|
|
580
581
|
if (!obj.hasOwnProperty(subprop)) {
|
|
581
582
|
this.removeProperty(subprop);
|
|
582
583
|
delete this._values[subprop];
|
|
@@ -594,16 +595,16 @@ exports.shorthandSetter = function(property, shorthand_for) {
|
|
|
594
595
|
};
|
|
595
596
|
};
|
|
596
597
|
|
|
597
|
-
exports.shorthandGetter = function(property, shorthand_for) {
|
|
598
|
-
return function() {
|
|
598
|
+
exports.shorthandGetter = function (property, shorthand_for) {
|
|
599
|
+
return function () {
|
|
599
600
|
if (this._values[property] !== undefined) {
|
|
600
601
|
return this.getPropertyValue(property);
|
|
601
602
|
}
|
|
602
603
|
return Object.keys(shorthand_for)
|
|
603
|
-
.map(function(subprop) {
|
|
604
|
+
.map(function (subprop) {
|
|
604
605
|
return this.getPropertyValue(subprop);
|
|
605
606
|
}, this)
|
|
606
|
-
.filter(function(value) {
|
|
607
|
+
.filter(function (value) {
|
|
607
608
|
return value !== '';
|
|
608
609
|
})
|
|
609
610
|
.join(' ');
|
|
@@ -615,14 +616,14 @@ exports.shorthandGetter = function(property, shorthand_for) {
|
|
|
615
616
|
// if two, the first applies to the top and bottom, and the second to left and right
|
|
616
617
|
// if three, the first applies to the top, the second to left and right, the third bottom
|
|
617
618
|
// if four, top, right, bottom, left
|
|
618
|
-
exports.implicitSetter = function(property_before, property_after, isValid, parser) {
|
|
619
|
+
exports.implicitSetter = function (property_before, property_after, isValid, parser) {
|
|
619
620
|
property_after = property_after || '';
|
|
620
621
|
if (property_after !== '') {
|
|
621
622
|
property_after = '-' + property_after;
|
|
622
623
|
}
|
|
623
624
|
var part_names = ['top', 'right', 'bottom', 'left'];
|
|
624
625
|
|
|
625
|
-
return function(v) {
|
|
626
|
+
return function (v) {
|
|
626
627
|
if (typeof v === 'number') {
|
|
627
628
|
v = v.toString();
|
|
628
629
|
}
|
|
@@ -643,7 +644,7 @@ exports.implicitSetter = function(property_before, property_after, isValid, pars
|
|
|
643
644
|
return undefined;
|
|
644
645
|
}
|
|
645
646
|
|
|
646
|
-
parts = parts.map(function(part) {
|
|
647
|
+
parts = parts.map(function (part) {
|
|
647
648
|
return parser(part);
|
|
648
649
|
});
|
|
649
650
|
this._setProperty(property_before + property_after, parts.join(' '));
|
|
@@ -674,11 +675,11 @@ exports.implicitSetter = function(property_before, property_after, isValid, pars
|
|
|
674
675
|
// sub-parts are set. If so, it sets the shorthand version and removes
|
|
675
676
|
// the individual parts from the cssText.
|
|
676
677
|
//
|
|
677
|
-
exports.subImplicitSetter = function(prefix, part, isValid, parser) {
|
|
678
|
+
exports.subImplicitSetter = function (prefix, part, isValid, parser) {
|
|
678
679
|
var property = prefix + '-' + part;
|
|
679
680
|
var subparts = [prefix + '-top', prefix + '-right', prefix + '-bottom', prefix + '-left'];
|
|
680
681
|
|
|
681
|
-
return function(v) {
|
|
682
|
+
return function (v) {
|
|
682
683
|
if (typeof v === 'number') {
|
|
683
684
|
v = v.toString();
|
|
684
685
|
}
|
|
@@ -711,7 +712,7 @@ exports.subImplicitSetter = function(prefix, part, isValid, parser) {
|
|
|
711
712
|
var camel_to_dashed = /[A-Z]/g;
|
|
712
713
|
var first_segment = /^\([^-]\)-/;
|
|
713
714
|
var vendor_prefixes = ['o', 'moz', 'ms', 'webkit'];
|
|
714
|
-
exports.camelToDashed = function(camel_case) {
|
|
715
|
+
exports.camelToDashed = function (camel_case) {
|
|
715
716
|
var match;
|
|
716
717
|
var dashed = camel_case.replace(camel_to_dashed, '-$&').toLowerCase();
|
|
717
718
|
match = dashed.match(first_segment);
|
|
@@ -3,16 +3,13 @@
|
|
|
3
3
|
var parsers = require('../parsers');
|
|
4
4
|
|
|
5
5
|
module.exports.definition = {
|
|
6
|
-
set: function(v) {
|
|
6
|
+
set: function (v) {
|
|
7
7
|
var valueType = parsers.valueType(v);
|
|
8
8
|
if (valueType === parsers.TYPES.ANGLE) {
|
|
9
9
|
return this._setProperty('azimuth', parsers.parseAngle(v));
|
|
10
10
|
}
|
|
11
11
|
if (valueType === parsers.TYPES.KEYWORD) {
|
|
12
|
-
var keywords = v
|
|
13
|
-
.toLowerCase()
|
|
14
|
-
.trim()
|
|
15
|
-
.split(/\s+/);
|
|
12
|
+
var keywords = v.toLowerCase().trim().split(/\s+/);
|
|
16
13
|
var hasBehind = false;
|
|
17
14
|
if (keywords.length > 2) {
|
|
18
15
|
return;
|
|
@@ -59,7 +56,7 @@ module.exports.definition = {
|
|
|
59
56
|
}
|
|
60
57
|
}
|
|
61
58
|
},
|
|
62
|
-
get: function() {
|
|
59
|
+
get: function () {
|
|
63
60
|
return this.getPropertyValue('azimuth');
|
|
64
61
|
},
|
|
65
62
|
enumerable: true,
|
|
@@ -10,13 +10,13 @@ var isValid = (module.exports.isValid = function isValid(v) {
|
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
module.exports.definition = {
|
|
13
|
-
set: function(v) {
|
|
13
|
+
set: function (v) {
|
|
14
14
|
if (!isValid(v)) {
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
17
|
this._setProperty('background-attachment', v);
|
|
18
18
|
},
|
|
19
|
-
get: function() {
|
|
19
|
+
get: function () {
|
|
20
20
|
return this.getPropertyValue('background-attachment');
|
|
21
21
|
},
|
|
22
22
|
enumerable: true,
|
|
@@ -21,14 +21,14 @@ module.exports.isValid = function isValid(v) {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
module.exports.definition = {
|
|
24
|
-
set: function(v) {
|
|
24
|
+
set: function (v) {
|
|
25
25
|
var parsed = parse(v);
|
|
26
26
|
if (parsed === undefined) {
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
this._setProperty('background-color', parsed);
|
|
30
30
|
},
|
|
31
|
-
get: function() {
|
|
31
|
+
get: function () {
|
|
32
32
|
return this.getPropertyValue('background-color');
|
|
33
33
|
},
|
|
34
34
|
enumerable: true,
|
|
@@ -21,10 +21,10 @@ module.exports.isValid = function isValid(v) {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
module.exports.definition = {
|
|
24
|
-
set: function(v) {
|
|
24
|
+
set: function (v) {
|
|
25
25
|
this._setProperty('background-image', parse(v));
|
|
26
26
|
},
|
|
27
|
-
get: function() {
|
|
27
|
+
get: function () {
|
|
28
28
|
return this.getPropertyValue('background-image');
|
|
29
29
|
},
|
|
30
30
|
enumerable: true,
|