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

Attribute-based styles not always updated #132

Closed
anniesullie opened this issue May 14, 2013 · 4 comments
Closed

Attribute-based styles not always updated #132

anniesullie opened this issue May 14, 2013 · 4 comments
Assignees

Comments

@anniesullie
Copy link

I made a jsfiddle to reduce a problem I was seeing in a larger app:
http://jsfiddle.net/mYEcL/

My custom element has a table, and an attribute that can be set to the id of a column header. When the attribute is changed, a style should be applied to the column header. I implemented this by setting a second attribute on the element and styling th[myattr=val] in the custom element.

When I change the attribute from a click handler inside the element, the style is applied correctly. When I set the attribute from a script outside the element, the style is not always applied.

You can reproduce in the jsfiddle by clicking on the "One" and "Two" table headers in the custom elements, and the "Highlight One" and "Highlight Two" buttons. The "Highlight Two" button never highlights the "Two" column, even though the attribute gets set properly. This doesn't happen when clicking on the column itself.

@sjmiles
Copy link
Contributor

sjmiles commented May 14, 2013

Hi Annie,

Confirm your problem, we believe this is a ShadowDOM bug in Blink. We will file a ticket for it (and post a reference here).

Steve discovered that adding style="display:table-cell" to #two makes the problem go away, at least in the fiddle. Perhaps that is a workaround for you until the core bug is fixed.

Also, I took the liberty of creating a second version of your fiddle just to show how we would reduce it using a bit more Polymer methodology. Let me know what you think.

http://jsfiddle.net/vYE4g/4/

@anniesullie
Copy link
Author

Thanks for the quick response! style="display:table-cell" successfully worked around the problem in my larger app as well.

And thanks for the hint about classFollows. Are there docs I should be reading to know about functions like that?

@sjmiles
Copy link
Contributor

sjmiles commented May 14, 2013

Are there docs I should be reading to know about functions like that?

Sorry, not really. We are still early days for the high-level stuff, we've spent most of our time working on the polyfills. We do recognize the important of docs, and very much appreciate you being a trail-blazer. I literally expect this conversation we are having to be useful for others. =P

Fwiw, the 'base' api that all polymer elements receive is spelled out here: https://github.com/polymer-project/polymer/blob/master/src/base.js

... and I will make a ticket to add inline doc comments there asap.

@sorvell
Copy link
Contributor

sorvell commented May 15, 2013

It looks like this has been fixed on the latest canary.

Here's an updated fiddle which uses the new cdn:
http://jsfiddle.net/mYEcL/2/

@ghost ghost assigned sorvell Jun 12, 2013
@sorvell sorvell closed this as completed Jun 13, 2013
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

3 participants