From f95fd3276d22f02243b5c4cf97a3dd1f5693355c Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Fri, 9 Aug 2019 12:29:55 -0700 Subject: [PATCH] Fix issue with camel cased properties and disable-upgrade --- lib/mixins/properties-changed.js | 6 ++++-- lib/mixins/properties-mixin.js | 2 +- test/unit/disable-upgrade.html | 27 +++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/lib/mixins/properties-changed.js b/lib/mixins/properties-changed.js index d200a3dffc..22766a3164 100644 --- a/lib/mixins/properties-changed.js +++ b/lib/mixins/properties-changed.js @@ -134,10 +134,12 @@ export const PropertiesChanged = dedupingMixin( if (!this.hasOwnProperty('__dataAttributes')) { this.__dataAttributes = Object.assign({}, this.__dataAttributes); } - if (!this.__dataAttributes[property]) { - const attr = this.constructor.attributeNameForProperty(property); + let attr = this.__dataAttributes[property]; + if (!attr) { + attr = this.constructor.attributeNameForProperty(property); this.__dataAttributes[attr] = property; } + return attr; } /** diff --git a/lib/mixins/properties-mixin.js b/lib/mixins/properties-mixin.js index 06fe449d38..9420e79769 100644 --- a/lib/mixins/properties-mixin.js +++ b/lib/mixins/properties-mixin.js @@ -122,7 +122,7 @@ export const PropertiesMixin = dedupingMixin(superClass => { if (!this.hasOwnProperty('__observedAttributes')) { register(this.prototype); const props = this._properties; - this.__observedAttributes = props ? Object.keys(props).map(p => this.attributeNameForProperty(p)) : []; + this.__observedAttributes = props ? Object.keys(props).map(p => this.prototype._addPropertyToAttributeMap(p)) : []; } return this.__observedAttributes; } diff --git a/test/unit/disable-upgrade.html b/test/unit/disable-upgrade.html index ff705f7e9f..158935b9cc 100644 --- a/test/unit/disable-upgrade.html +++ b/test/unit/disable-upgrade.html @@ -271,6 +271,25 @@

[[prop]]

+ +