File tree Expand file tree Collapse file tree 3 files changed +32
-3
lines changed
Expand file tree Collapse file tree 3 files changed +32
-3
lines changed Original file line number Diff line number Diff line change @@ -134,10 +134,12 @@ export const PropertiesChanged = dedupingMixin(
134134 if ( ! this . hasOwnProperty ( '__dataAttributes' ) ) {
135135 this . __dataAttributes = Object . assign ( { } , this . __dataAttributes ) ;
136136 }
137- if ( ! this . __dataAttributes [ property ] ) {
138- const attr = this . constructor . attributeNameForProperty ( property ) ;
137+ let attr = this . __dataAttributes [ property ] ;
138+ if ( ! attr ) {
139+ attr = this . constructor . attributeNameForProperty ( property ) ;
139140 this . __dataAttributes [ attr ] = property ;
140141 }
142+ return attr ;
141143 }
142144
143145 /**
Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ export const PropertiesMixin = dedupingMixin(superClass => {
122122 if ( ! this . hasOwnProperty ( '__observedAttributes' ) ) {
123123 register ( this . prototype ) ;
124124 const props = this . _properties ;
125- this . __observedAttributes = props ? Object . keys ( props ) . map ( p => this . attributeNameForProperty ( p ) ) : [ ] ;
125+ this . __observedAttributes = props ? Object . keys ( props ) . map ( p => this . prototype . _addPropertyToAttributeMap ( p ) ) : [ ] ;
126126 }
127127 return this . __observedAttributes ;
128128 }
Original file line number Diff line number Diff line change @@ -271,6 +271,25 @@ <h2 id="element">[[prop]]</h2>
271271 </ script >
272272</ dom-module >
273273
274+ < script type ="module ">
275+ import { Polymer } from '../../lib/legacy/polymer-fn.js' ;
276+ Polymer ( {
277+ is : 'x-disabled-camel' ,
278+ properties : {
279+ camelCaseProperty : Boolean ,
280+ bootedCorrectly : {
281+ type : Boolean ,
282+ value : false
283+ }
284+ } ,
285+ attached ( ) {
286+ if ( this . camelCaseProperty ) {
287+ this . bootedCorrectly = true ;
288+ }
289+ }
290+ } ) ;
291+ </ script >
292+
274293 < script type ="module ">
275294import '../../lib/mixins/disable-upgrade-mixin.js' ;
276295import { flush } from '../../lib/utils/flush.js' ;
@@ -433,6 +452,14 @@ <h2 id="element">[[prop]]</h2>
433452 assert . ok ( el . $ . disabledBoundEl . wasDisconnected ) ;
434453 } ) ;
435454
455+ test ( 'elements with camelCase properties initialize correctly after being enabled' , function ( ) {
456+ const div = document . createElement ( 'div' ) ;
457+ div . innerHTML = `<x-disabled-camel disable-upgrade camel-case-property></x-disabled-camel>` ;
458+ const camel = div . querySelector ( 'x-disabled-camel' ) ;
459+ document . body . appendChild ( div ) ;
460+ camel . removeAttribute ( 'disable-upgrade' ) ;
461+ assert . ok ( camel . bootedCorrectly ) ;
462+ } ) ;
436463
437464} ) ;
438465
You can’t perform that action at this time.
0 commit comments