File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,23 @@ class ConfigClass extends Block {
139
139
140
140
ConfigClass . bindAttributes ( attrStateMapping ) ;
141
141
142
+ /**
143
+ * Define getters and setters for all config keys on the Custom Element class prototype to make them checkable using
144
+ * `key in element` syntax. This is required for the frameworks DOM property bindings to work.
145
+ */
146
+ for ( const key of allConfigKeys ) {
147
+ const localPropName = '__' + key ;
148
+ Object . defineProperty ( ConfigClass . prototype , key , {
149
+ /** @param {unknown } value */
150
+ set : function ( value ) {
151
+ this [ localPropName ] = value ;
152
+ } ,
153
+ get : function ( ) {
154
+ return this [ localPropName ] ;
155
+ } ,
156
+ } ) ;
157
+ }
158
+
142
159
/** @typedef {import('../../utils/mixinClass.js').MixinClass<typeof ConfigClass, import('../../types').ConfigType> } Config */
143
160
144
161
// This is workaround for jsdoc that allows us to export extended class type along with the class itself
You can’t perform that action at this time.
0 commit comments