diff --git a/lib/mixins/element-mixin.js b/lib/mixins/element-mixin.js index af20117459..b31e25f8b4 100644 --- a/lib/mixins/element-mixin.js +++ b/lib/mixins/element-mixin.js @@ -487,11 +487,17 @@ export const ElementMixin = dedupingMixin(base => { // or set in registered(); once the static getter runs, a clone of it // will overwrite it on the prototype as the working template. if (!this.hasOwnProperty(JSCompiler_renameProperty('_template', this))) { + const protoTemplate = this.prototype.hasOwnProperty( + JSCompiler_renameProperty('_template', this.prototype)) ? + this.prototype._template : undefined; this._template = // If user has put template on prototype (e.g. in legacy via registered - // callback or info object), prefer that first - this.prototype.hasOwnProperty(JSCompiler_renameProperty('_template', this.prototype)) ? - this.prototype._template : + // callback or info object), prefer that first. Note that `null` is + // used as a sentinel to indicate "no template" and can be used to + // override a super template, whereas `undefined` is used as a + // sentinel to mean "fall-back to default template lookup" via + // dom-module and/or super.template. + protoTemplate !== undefined ? protoTemplate : // Look in dom-module associated with this element's is ((this.hasOwnProperty(JSCompiler_renameProperty('is', this)) && (getTemplateFromDomModule(/** @type {PolymerElementConstructor}*/ (this).is))) || diff --git a/test/unit/inheritance.html b/test/unit/inheritance.html index 346498a935..6561023c24 100644 --- a/test/unit/inheritance.html +++ b/test/unit/inheritance.html @@ -17,6 +17,18 @@
+