diff --git a/lib/legacy/class.html b/lib/legacy/class.html index cf22f43b53..e61e9e51dd 100644 --- a/lib/legacy/class.html +++ b/lib/legacy/class.html @@ -351,6 +351,15 @@ Polymer.LegacyElementMixin(HTMLElement)); // decorate klass with registration info klass.is = info.is; + // To match 1.x behavior, `_template` supplied on a behavior should take + // precedence over dom-module lookup for `is`; this also prevents + // dom-module injection under strictTemplatePolicy for an element that + // would normally get its template from a behavior. + // TODO(sorvell): Remove once "flattened behaviors" lands, since both + // `_template` and `is` will be on the same class after that change + if (klass.prototype._template !== undefined) { + klass.prototype._template = klass.prototype._template; + } return klass; }; diff --git a/test/unit/behaviors.html b/test/unit/behaviors.html index 3a9c915f50..98cf74dd7d 100644 --- a/test/unit/behaviors.html +++ b/test/unit/behaviors.html @@ -602,8 +602,8 @@ test('template from base', function() { var el = fixture('from-base'); - assert.ok(el.shadowRoot.querySelector('#from-base')); - assert.notOk(el.shadowRoot.querySelector('#from-behavior1')); + assert.notOk(el.shadowRoot.querySelector('#from-base')); + assert.ok(el.shadowRoot.querySelector('#from-behavior1')); }); test('template from behavior', function() {