Skip to content

Commit

Permalink
[ci-skip] Add comment explaining confusing check in _addPropertyToAtt…
Browse files Browse the repository at this point in the history
…ributeMap
  • Loading branch information
kevinpschaaf committed Aug 26, 2019
1 parent e534c3c commit c65a58a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/mixins/properties-changed.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c65a58a

Please sign in to comment.