diff --git a/lib/mixins/element-mixin.html b/lib/mixins/element-mixin.html index 30af1ec1a7..f00316c6e8 100644 --- a/lib/mixins/element-mixin.html +++ b/lib/mixins/element-mixin.html @@ -596,7 +596,7 @@ * @override */ connectedCallback() { - if (window.ShadyCSS) { + if (window.ShadyCSS && this._template) { window.ShadyCSS.styleElement(this); } if (!this.__dataInitialized) { diff --git a/test/runner.html b/test/runner.html index 9a9f1b003a..3b35f9c9f1 100644 --- a/test/runner.html +++ b/test/runner.html @@ -36,6 +36,7 @@ 'unit/styling-cross-scope-var.html', 'unit/styling-cross-scope-apply.html', 'unit/styling-cross-scope-unknown-host.html', + 'unit/styling-only-with-template.html', 'unit/custom-style.html', 'unit/custom-style-late.html', 'unit/custom-style-async.html', diff --git a/test/unit/styling-only-with-template.html b/test/unit/styling-only-with-template.html new file mode 100644 index 0000000000..8239ad595d --- /dev/null +++ b/test/unit/styling-only-with-template.html @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + \ No newline at end of file