Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom properties defined in :host don't reapply if the rule is inside a media query. #3696

Closed
blasten opened this issue Jun 8, 2016 · 2 comments
Assignees

Comments

@blasten
Copy link
Contributor

blasten commented Jun 8, 2016

Description

Say you have:

:host {
  display: block;
  --color: red;
}

div {
  color: var(--color);  
}

@media (max-width: 800px) {
  :host {
    --color: blue;
  }
}

Live Demo

https://jsbin.com/mekike/edit?html,output

Expected Results

I'd expect the div's color to be blue if the media query is matching.

Actual Results

The div's color remains red unless you refresh the browser.

Browsers Affected

  • All browsers

Versions

  • Polymer: master and useNativeCSSProperties = false
@dfreedm dfreedm self-assigned this Jun 8, 2016
@dfreedm
Copy link
Member

dfreedm commented Jun 8, 2016

This is due to the style caching system thinking :root and :host properties do not need to be rechecked on updateStyles().
The simple fix is to disable style caching, and the harder fix is to only disable style caching when @media or :host() selectors are used

@dfreedm
Copy link
Member

dfreedm commented Jun 8, 2016

@sorvell

dfreedm added a commit that referenced this issue Jun 9, 2016
…xt() selectors

Mark style rules in parsing rather than runtime to make sure scope'd
bitmask is consistent.

Add tests for cache coherency.

Fixes #3696
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants