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
diff --git a/test/unit/dom-repeat.html b/test/unit/dom-repeat.html
index be42bb7d19..46eefa5e4c 100644
--- a/test/unit/dom-repeat.html
+++ b/test/unit/dom-repeat.html
@@ -830,7 +830,8 @@ x-repeat-chunked
assert.equal(stamped2[39].itemaProp, 'new-1');
assert.equal(stamped2[40].itemaProp, 'new-2');
assert.equal(stamped2[41], undefined);
- assert.equal(unconfigured1.domUpdateHandlerCount, 1);
+ assert.equal(unconfigured1.domUpdateHandlerCount,
+ Polymer.Settings.suppressTemplateNotifications ? 0 : 1);
done();
});
});
@@ -853,7 +854,8 @@ x-repeat-chunked
assert.equal(stamped2[38].indexb, 2);
assert.equal(stamped2[38].indexc, 2);
assert.equal(stamped2[39], undefined);
- assert.equal(unconfigured1.domUpdateHandlerCount, 1);
+ assert.equal(unconfigured1.domUpdateHandlerCount,
+ Polymer.Settings.suppressTemplateNotifications ? 0 : 1);
done();
});
});
@@ -3250,6 +3252,7 @@ x-repeat-chunked
});
});
});
+
});
suite('repeater API', function() {
@@ -3867,6 +3870,23 @@ x-repeat-chunked
});
+ suite('notification suppression', function() {
+
+ test('re-enable dom-change', function() {
+ if (Polymer.Settings.suppressTemplateNotifications) {
+ test('enable dom-change on instance', function() {
+ unconfigured1.$.repeater.setAttribute('notify-dom-change', '');
+ unconfigured1.domUpdateHandlerCount = 0;
+ unconfigured.items = unconfigured.items.slice();
+ setTimeout(function() {
+ assert.equal(unconfigured1.domUpdateHandlerCount, 1);
+ });
+ });
+ }
+ });
+
+ });
+
}