Skip to content

Published property with default value not reflected #509

Description

@arthurevans

If I create a published property with a default value and reflect: true, the property isn't reflected as an attribute until I change the property. Test case here:

http://jsbin.com/sogon/7/edit

The text here should show up in red (and the should show up as in devtools), but it doesn't.

If you use devtools to change the highlight value to 'red', nothing happens -- apparently we detect that the value hasn't changed and don't serialize it.

If you change it to another value then back to red, it works.

Currently, you can work around this by just setting reflect: true in the publish block and setting the default value in the ready callback. But it seems like the default value should reflect correctly.

Activity

  1. sjmiles commented on May 21, 2014

    @sjmiles
    Contributor

    No standard element reflects the default value of an attribute. If that was the case, the runtime DOM would explode with attributes.

    If there is a bug, it's probably that it ever reflects a value that matches the prototype default.

  2. arthurevans commented on Jun 10, 2014

    @arthurevans
    Author

    This is documented as the current behavior:
    http://www.polymer-project.org/docs/polymer/polymer.html#attrreflection

    Closing issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions