diff --git a/src/lib/template/dom-bind.html b/src/lib/template/dom-bind.html index 10dc8bf40c..d710c98a31 100644 --- a/src/lib/template/dom-bind.html +++ b/src/lib/template/dom-bind.html @@ -168,7 +168,9 @@ this._children = Polymer.TreeApi.arrayCopyChildNodes(this.root); } this._insertChildren(); - this.fire('dom-change'); + if (!Polymer.Settings.suppressTemplateNotifications) { + this.fire('dom-change'); + } } }); diff --git a/src/lib/template/dom-if.html b/src/lib/template/dom-if.html index cfe4731430..dc018ba579 100644 --- a/src/lib/template/dom-if.html +++ b/src/lib/template/dom-if.html @@ -60,6 +60,15 @@ type: Boolean, value: false, observer: '_queueRender' + }, + + /** + * When the global `Polymer.Settings.suppressDomChange` setting is used, + * setting `notifyDomChange: true` will enable firing `dom-change` events + * on this element. + */ + notifyDomChange: { + type: Boolean } }, @@ -114,7 +123,9 @@ this._showHideChildren(); } if (this.if != this._lastIf) { - this.fire('dom-change'); + if (!Polymer.Settings.suppressTemplateNotifications || this.notifyDomChange) { + this.fire('dom-change'); + } this._lastIf = this.if; } }, diff --git a/src/lib/template/dom-repeat.html b/src/lib/template/dom-repeat.html index 6272eeceb8..07f56d9c2d 100644 --- a/src/lib/template/dom-repeat.html +++ b/src/lib/template/dom-repeat.html @@ -211,7 +211,7 @@ */ renderedItemCount: { type: Number, - notify: true, + notify: !Polymer.Settings.suppressTemplateNotifications, readOnly: true }, @@ -240,6 +240,15 @@ value: 20 }, + /** + * When the global `Polymer.Settings.suppressDomChange` setting is used, + * setting `notifyDomChange: true` will enable firing `dom-change` events + * on this element. + */ + notifyDomChange: { + type: Boolean + }, + _targetFrameTime: { type: Number, computed: '_computeFrameTime(targetFramerate)' @@ -470,7 +479,9 @@ // Set rendered item count this._setRenderedItemCount(this._instances.length); // Notify users - this.fire('dom-change'); + if (!Polymer.Settings.suppressTemplateNotifications || this.notifyDomChange) { + this.fire('dom-change'); + } // Check to see if we need to render more items this._tryRenderChunk(); }, diff --git a/src/lib/template/templatizer.html b/src/lib/template/templatizer.html index 0cbdee5dbd..5faa556b76 100644 --- a/src/lib/template/templatizer.html +++ b/src/lib/template/templatizer.html @@ -254,6 +254,8 @@ effect: {event: Polymer.CaseMap.camelToDashCase(parentProp) + '-changed'} }]; + proto._propertyEffects = proto._propertyEffects || {}; + proto._propertyEffects[parentProp] = effects; Polymer.Bind._createAccessors(proto, parentProp, effects); } } @@ -282,7 +284,7 @@ _createHostPropEffector: function(prop) { var prefix = this._parentPropPrefix; return function(source, value) { - this.dataHost._templatized[prefix + prop] = value; + this.dataHost._templatized.__setProperty(prefix + prop, value); }; }, @@ -305,10 +307,16 @@ } for (var i=0, n; (i