diff --git a/src/lib/template/templatizer.html b/src/lib/template/templatizer.html index ee8ea789d9..b76fcc463a 100644 --- a/src/lib/template/templatizer.html +++ b/src/lib/template/templatizer.html @@ -124,6 +124,8 @@ archetype._scopeElementClass = this._scopeElementClassImpl; archetype.listen = this._listenImpl; archetype._showHideChildren = this._showHideChildrenImpl; + archetype.__setPropertyOrig = this.__setProperty; + archetype.__setProperty = this.__setPropertyImpl; // boilerplate code var _constructor = this._constructorImpl; var ctor = function TemplateInstance(model, host) { @@ -168,6 +170,13 @@ } }, + __setPropertyImpl: function(property, value, fromAbove, node) { + if (node && node.__hideTemplateChildren__ && property == 'textContent') { + property = '__polymerTextContent__'; + } + this.__setPropertyOrig(property, value, fromAbove, node); + }, + _debounceTemplate: function(fn) { Polymer.dom.addDebouncer(this.debounce('_debounceTemplate', fn)); }, @@ -242,7 +251,7 @@ }, { kind: 'notify', fn: Polymer.Bind._notifyEffect, - effect: {event: + effect: {event: Polymer.CaseMap.camelToDashCase(parentProp) + '-changed'} }]; Polymer.Bind._createAccessors(proto, parentProp, effects); @@ -259,7 +268,7 @@ } this._extendTemplate(template, proto); template._pathEffector = function(path, value, fromAbove) { - return self._pathEffectorImpl(path, value, fromAbove); + return self._pathEffectorImpl(path, value, fromAbove); } } }, diff --git a/test/unit/dom-if-elements.html b/test/unit/dom-if-elements.html index f569bebfa3..2c421a262c 100644 --- a/test/unit/dom-if-elements.html +++ b/test/unit/dom-if-elements.html @@ -165,13 +165,18 @@
1
2
3
- Stuff + {{text}}
4
diff --git a/test/unit/dom-if.html b/test/unit/dom-if.html index 1050514d99..71ebe04616 100644 --- a/test/unit/dom-if.html +++ b/test/unit/dom-if.html @@ -495,6 +495,27 @@ document.body.removeChild(x); }); + test('binding to text nodes changed while if=false', function() { + var x = document.createElement('x-textcontent'); + document.body.appendChild(x); + x.$.domIf.render(); + var stamped = Polymer.dom(x.root).childNodes; + assert.equal(stamped.length, 12); + assert.equal(stamped[7].textContent.trim(), 'Stuff'); + x.$.domIf.if = false; + x.$.domIf.render(); + x.text = 'Hollaaaaa!'; + stamped = Polymer.dom(x.root).childNodes; + assert.equal(stamped.length, 12); + assert.equal(stamped[7].textContent.trim(), ''); + x.$.domIf.if = true; + x.$.domIf.render(); + stamped = Polymer.dom(x.root).childNodes; + assert.equal(stamped.length, 12); + assert.equal(stamped[7].textContent.trim(), 'Hollaaaaa!'); + document.body.removeChild(x); + }); + }); suite('queueing race conditions', function() {