mirror of
https://github.com/Polymer/polymer.git
synced 2026-08-19 01:14:44 -05:00
Ensure _template from behaviors takes precedence over is in legacy.
This commit is contained in:
@@ -351,6 +351,15 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
@@ -602,8 +602,8 @@ suite('templates from behaviors', function() {
|
||||
|
||||
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() {
|
||||
|
||||
Reference in New Issue
Block a user