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

Consider if/when/how to reflect bound property values to attributes #188

Closed
sorvell opened this issue Jun 21, 2013 · 1 comment
Closed

Comments

@sorvell
Copy link
Contributor

sorvell commented Jun 21, 2013

Polymer augments basic mdv attribute binding behavior by allowing 'published' properties to be bound directly to model values. This provides a form of 2-way binding and removes the restriction that bound data be string valued.

Polymer does not currently reflect bound property values back to attribute values and this is a source of potential confusion. For background, see: https://groups.google.com/forum/#!searchin/polymer-dev/attributes/polymer-dev/S1jqJppSNCs/GztkRpykOnAJ.

The notion is that these attribute values are used only for initialization purposes (similar to input's value attribute) and that developers should be programmatically interacting with properties and not attributes.

There are some times a developer wants to reflect property values back to attributes; for example, for styling based on attribute selectors or to interact with other libraries/elements that expect changes to attributes.

cc @ebidel

sorvell added a commit that referenced this issue Jul 24, 2013
 - attributes are now reflected to property values at runtime, not only at create time. The rules are the same, the attribute is deserialized to the data type of the property in the element's prototype.
 - `published` properties are now reflected to attributes at runtime. This is done via observation and all published properties are now observed. Properties are serialized directly to strings and object and undefined valued
properties are ignored.
@sorvell sorvell closed this as completed Jul 24, 2013
@ebidel
Copy link
Contributor

ebidel commented Jul 26, 2013

This is 👍

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