Skip to content

Commit

Permalink
Add notifyDomChange back to dom-if & dom-repeat to match P1.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpschaaf committed Sep 19, 2019
1 parent 929d056 commit e9e0cd1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
12 changes: 10 additions & 2 deletions lib/elements/dom-if.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,16 @@ class DomIfBase extends PolymerElement {
restamp: {
type: Boolean,
observer: '__debounceRender'
}
},

/**
* When the global `legacyOptimizations` setting is used, setting
* `notifyDomChange: true` will enable firing `dom-change` events on this
* element.
*/
notifyDomChange: {
type: Boolean
}
};

}
Expand Down Expand Up @@ -244,7 +252,7 @@ class DomIfBase extends PolymerElement {
this.__teardownInstance();
}
this._showHideChildren();
if (!legacyOptimizations && this.if != this._lastIf) {
if ((!legacyOptimizations || this.notifyDomChange) && this.if != this._lastIf) {
this.dispatchEvent(new CustomEvent('dom-change', {
bubbles: true,
composed: true
Expand Down
11 changes: 10 additions & 1 deletion lib/elements/dom-repeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,15 @@ export class DomRepeat extends domRepeatBase {
_targetFrameTime: {
type: Number,
computed: '__computeFrameTime(targetFramerate)'
},

/**
* When the global `legacyOptimizations` setting is used, setting
* `notifyDomChange: true` will enable firing `dom-change` events on this
* element.
*/
notifyDomChange: {
type: Boolean
}

};
Expand Down Expand Up @@ -546,7 +555,7 @@ export class DomRepeat extends domRepeatBase {
// Set rendered item count
this._setRenderedItemCount(this.__instances.length);
// Notify users
if (!legacyOptimizations) {
if (!legacyOptimizations || this.notifyDomChange) {
this.dispatchEvent(new CustomEvent('dom-change', {
bubbles: true,
composed: true
Expand Down

0 comments on commit e9e0cd1

Please sign in to comment.