diff --git a/src/standard/x-styling.html b/src/standard/x-styling.html index 23150ed4f8..211565ec09 100644 --- a/src/standard/x-styling.html +++ b/src/standard/x-styling.html @@ -187,6 +187,15 @@ this._styleProperties, this._scopeSelector, info && info.style); // apply scope selector if (!nativeShadow) { + // update cached style to point to new style. + // TODO(sorvell): under ShadyDOM, the cached style is + // used to style the element and the cache must be updated to point + // to the 'active' style so elements can determine if updates are needed. + // This is not the case under Shadow DOM. Ideally the cache + // would be decoupled from style application/use. + if (info) { + info.style = style; + } propertyUtils.applyElementScopeSelector(this, this._scopeSelector, oldScopeSelector, this._scopeCssViaAttr); } diff --git a/test/unit/styling-cross-scope-var.html b/test/unit/styling-cross-scope-var.html index 36d0063b0d..2463842343 100644 --- a/test/unit/styling-cross-scope-var.html +++ b/test/unit/styling-cross-scope-var.html @@ -67,6 +67,10 @@ padding: 8px; border: var(--scope-var); } + + :host(.foo) { + border: var(--scope-var-foo); + } Host property @@ -77,6 +81,34 @@ + + + + + + + + + +