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

Style caching can be incorrect in document when style is=custom-style is used #3801

Closed
6 tasks done
dfreedm opened this issue Jul 23, 2016 · 2 comments
Closed
6 tasks done
Assignees
Labels

Comments

@dfreedm
Copy link
Member

dfreedm commented Jul 23, 2016

Description

Live Demo

test/smoke/custom-style-cache.html

Steps to Reproduce

Expected Results

First element has a font-size of 32px
Second element has a font-size of 12px

Actual Results

Both elements have a font-size of 32px

Browsers Affected

  • Chrome
  • Firefox
  • Edge
  • Safari 9
  • Safari 8
  • IE 11

Versions

  • Polymer: v1.6.0
@dfreedm dfreedm self-assigned this Jul 23, 2016
@sorvell
Copy link
Contributor

sorvell commented Jul 23, 2016

Quick debugging note: the test case is fixed if Polymer.updateStyles() is called.

@sorvell
Copy link
Contributor

sorvell commented Jul 23, 2016

The style caching system relies on the ability to know the index of each style rule. This indexing is performed not by the css parser but by the StyleProperties.decorateStyles. It is therefore required that a host has called this method prior to any elements in that scope calling _updateStyleProperties and looking up their scope style rules.

This should be guaranteed for any element scopes, but it is not guaranteed for the root styling scope, Polymer.StyleDefaults. StyleDefaults only decorates its styles the first time _styleProperties is read.

This may be after an element in this scope calls _updateStyleProperties and tries to calculate scope data.

One way to fix this is to make sure the scope has _styleProperties right when the scope is determined at the top of _updateStyleProperties.

sorvell pushed a commit that referenced this issue Jul 27, 2016
…ement. This ensures the scope's styles are prepared to be inspected by the element for matching rules.
@sorvell sorvell mentioned this issue Jul 27, 2016
dfreedm added a commit that referenced this issue Jul 27, 2016
jorgecasar pushed a commit to jorgecasar/polymer that referenced this issue Aug 14, 2016
…fore element. This ensures the scope's styles are prepared to be inspected by the element for matching rules.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants