From c65a58aeae81d253ab75df4e238ed953f67e5649 Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Mon, 26 Aug 2019 16:44:40 -0700 Subject: [PATCH] [ci-skip] Add comment explaining confusing check in _addPropertyToAttributeMap --- lib/mixins/properties-changed.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/mixins/properties-changed.js b/lib/mixins/properties-changed.js index 22766a3164..cc2801d415 100644 --- a/lib/mixins/properties-changed.js +++ b/lib/mixins/properties-changed.js @@ -134,6 +134,12 @@ export const PropertiesChanged = dedupingMixin( if (!this.hasOwnProperty('__dataAttributes')) { this.__dataAttributes = Object.assign({}, this.__dataAttributes); } + // This check is technically not correct; it's an optimization that + // assumes that if a _property_ name is already in the map (note this is + // an attr->property map), the property mapped directly to the attribute + // and it has already been mapped. This would fail if + // `attributeNameForProperty` were overridden such that this was not the + // case. let attr = this.__dataAttributes[property]; if (!attr) { attr = this.constructor.attributeNameForProperty(property);