@@ -7,25 +7,26 @@ var CSSOM = require('cssom');
7
7
var allProperties = require ( './allProperties' ) ;
8
8
var allExtraProperties = require ( './allExtraProperties' ) ;
9
9
var implementedProperties = require ( './implementedProperties' ) ;
10
- var { dashedToCamelCase } = require ( './parsers' ) ;
10
+ var { cssPropertyToIDLAttribute } = require ( './parsers' ) ;
11
11
var getBasicPropertyDescriptor = require ( './utils/getBasicPropertyDescriptor' ) ;
12
12
const idlUtils = require ( './utils.js' ) ;
13
13
14
- class CSSStyleDeclaration {
14
+ class CSSStyleDeclarationImpl {
15
15
/**
16
16
* @constructor
17
17
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration
18
+ *
19
+ * @param {object } globalObject
20
+ * @param {*[] } args
21
+ * @param {object } privateData
22
+ * @param {((cssText: string) => void) | null } [privateData.onChangeCallback]
18
23
*/
19
- constructor ( globalObject , args , { onChangeCallback } ) {
24
+ constructor ( globalObject , args , { onChangeCallback = null } ) {
20
25
this . _globalObject = globalObject ;
21
26
this . _values = { } ;
22
27
this . _importants = { } ;
23
28
this . _length = 0 ;
24
- this . _onChange =
25
- onChangeCallback ||
26
- function ( ) {
27
- return ;
28
- } ;
29
+ this . _onChange = onChangeCallback || ( ( ) => { } ) ;
29
30
}
30
31
31
32
/**
@@ -150,7 +151,7 @@ class CSSStyleDeclaration {
150
151
}
151
152
}
152
153
153
- Object . defineProperties ( CSSStyleDeclaration . prototype , {
154
+ Object . defineProperties ( CSSStyleDeclarationImpl . prototype , {
154
155
cssText : {
155
156
get : function ( ) {
156
157
var properties = [ ] ;
@@ -224,22 +225,30 @@ Object.defineProperties(CSSStyleDeclaration.prototype, {
224
225
} ,
225
226
} ) ;
226
227
227
- require ( './properties' ) ( CSSStyleDeclaration . prototype ) ;
228
+ require ( './properties' ) ( CSSStyleDeclarationImpl . prototype ) ;
228
229
229
230
allProperties . forEach ( function ( property ) {
230
231
if ( ! implementedProperties . has ( property ) ) {
231
232
var declaration = getBasicPropertyDescriptor ( property ) ;
232
- Object . defineProperty ( CSSStyleDeclaration . prototype , property , declaration ) ;
233
- Object . defineProperty ( CSSStyleDeclaration . prototype , dashedToCamelCase ( property ) , declaration ) ;
233
+ Object . defineProperty ( CSSStyleDeclarationImpl . prototype , property , declaration ) ;
234
+ Object . defineProperty (
235
+ CSSStyleDeclarationImpl . prototype ,
236
+ cssPropertyToIDLAttribute ( property ) ,
237
+ declaration
238
+ ) ;
234
239
}
235
240
} ) ;
236
241
237
242
allExtraProperties . forEach ( function ( property ) {
238
243
if ( ! implementedProperties . has ( property ) ) {
239
244
var declaration = getBasicPropertyDescriptor ( property ) ;
240
- Object . defineProperty ( CSSStyleDeclaration . prototype , property , declaration ) ;
241
- Object . defineProperty ( CSSStyleDeclaration . prototype , dashedToCamelCase ( property ) , declaration ) ;
245
+ Object . defineProperty ( CSSStyleDeclarationImpl . prototype , property , declaration ) ;
246
+ Object . defineProperty (
247
+ CSSStyleDeclarationImpl . prototype ,
248
+ cssPropertyToIDLAttribute ( property ) ,
249
+ declaration
250
+ ) ;
242
251
}
243
252
} ) ;
244
253
245
- exports . implementation = CSSStyleDeclaration ;
254
+ exports . implementation = CSSStyleDeclarationImpl ;
0 commit comments