@@ -7,25 +7,26 @@ var CSSOM = require('cssom');
77var allProperties = require ( './allProperties' ) ;
88var allExtraProperties = require ( './allExtraProperties' ) ;
99var implementedProperties = require ( './implementedProperties' ) ;
10- var { dashedToCamelCase } = require ( './parsers' ) ;
10+ var { cssPropertyToIDLAttribute } = require ( './parsers' ) ;
1111var getBasicPropertyDescriptor = require ( './utils/getBasicPropertyDescriptor' ) ;
1212const idlUtils = require ( './utils.js' ) ;
1313
14- class CSSStyleDeclaration {
14+ class CSSStyleDeclarationImpl {
1515 /**
1616 * @constructor
1717 * @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]
1823 */
19- constructor ( globalObject , args , { onChangeCallback } ) {
24+ constructor ( globalObject , args , { onChangeCallback = null } ) {
2025 this . _globalObject = globalObject ;
2126 this . _values = { } ;
2227 this . _importants = { } ;
2328 this . _length = 0 ;
24- this . _onChange =
25- onChangeCallback ||
26- function ( ) {
27- return ;
28- } ;
29+ this . _onChange = onChangeCallback || ( ( ) => { } ) ;
2930 }
3031
3132 /**
@@ -150,7 +151,7 @@ class CSSStyleDeclaration {
150151 }
151152}
152153
153- Object . defineProperties ( CSSStyleDeclaration . prototype , {
154+ Object . defineProperties ( CSSStyleDeclarationImpl . prototype , {
154155 cssText : {
155156 get : function ( ) {
156157 var properties = [ ] ;
@@ -224,22 +225,30 @@ Object.defineProperties(CSSStyleDeclaration.prototype, {
224225 } ,
225226} ) ;
226227
227- require ( './properties' ) ( CSSStyleDeclaration . prototype ) ;
228+ require ( './properties' ) ( CSSStyleDeclarationImpl . prototype ) ;
228229
229230allProperties . forEach ( function ( property ) {
230231 if ( ! implementedProperties . has ( property ) ) {
231232 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+ ) ;
234239 }
235240} ) ;
236241
237242allExtraProperties . forEach ( function ( property ) {
238243 if ( ! implementedProperties . has ( property ) ) {
239244 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+ ) ;
242251 }
243252} ) ;
244253
245- exports . implementation = CSSStyleDeclaration ;
254+ exports . implementation = CSSStyleDeclarationImpl ;
0 commit comments