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

Calling updateStyles before an element is attached does nothing and is confusing #3530

Closed
sorvell opened this issue Mar 24, 2016 · 3 comments · Fixed by #3724
Closed

Calling updateStyles before an element is attached does nothing and is confusing #3530

sorvell opened this issue Mar 24, 2016 · 3 comments · Fixed by #3724
Assignees
Labels

Comments

@sorvell
Copy link
Contributor

sorvell commented Mar 24, 2016

Calling updateStyles manually provokes the custom properties shim to update. Calling it before an element is attached has no effect. This is confusing to users and should either be fixed or produce a warning. For example, a developer might write an observer that calls this.updateStyles. This needs to be gated on attachment to function properly.

@sorvell sorvell added the p0 label Mar 24, 2016
@sorvell sorvell self-assigned this Mar 24, 2016
@peteblois
Copy link

This appears to be the result of some flakiness that we've been seeing for quite a while, where styles are not always being applied.

An repro of what has stymied us for a few months is:
http://jsbin.com/sixuquwevu/2/edit?html,js,output

Calling updateStyles on property change seems natural, I disagree that this should produce a warning (especially since the net effect appears to work after the element is attached).

The problem is that when the element is first attached styles are all updated, but after the element is re-attached, they are not.

@CSEMike
Copy link

CSEMike commented Jun 6, 2016

It is surprising to me that this P0 bug has not been updated in several months. What's the latest here?

@sorvell
Copy link
Contributor Author

sorvell commented Jun 16, 2016

Sorry for the delay. We are working on this issue. I believe it should be enough to ensure that if updateStyles is called when an element is not in the dom, we ensure that the scoping selector is removed. This will force the element to recalculate its style properties when it's later re-inserted into the dom.

sorvell pushed a commit that referenced this issue Jun 18, 2016
…ched, invalidate its styling so that when it is attached, its custom properties will be updated.

Also fixed a related issue with scope style cache disablement when :host function rules are used:
 * "property prepping" and decoration are now after static shimming so that transformed selectors are available to calculate :host function,
 * the detection of :host function properly accounts for type extension,
 * since "property prepping" was moved after shimming, apply shim was separated from this and moved before shimming so that its output can be used there.
dfreedm added a commit that referenced this issue Jun 23, 2016
Fixes #3530. When `updateStyles` is called and an element is not atta…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants