Skip to content

Commit

Permalink
Merge pull request Polymer#620 from arthurevans/docs-618
Browse files Browse the repository at this point in the history
Corrected default value for published properties
  • Loading branch information
Arthur Evans committed Aug 27, 2014
2 parents ef8f2f2 + a72e458 commit c47421c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions docs/polymer/polymer.md
Original file line number Diff line number Diff line change
Expand Up @@ -437,16 +437,20 @@ You should opt for the `publish` object when any of the following is true:

#### Default property values

By default, properties defined in `attributes` are initialized to `null`:
By default, properties defined in `attributes` are initialized to `undefined`:

<polymer-element name="x-foo" attributes="foo">
<script>
// x-foo has a foo property with default value of null.
// x-foo has a foo property with default value of undefined.
Polymer();
</script>
</polymer-element>

Specifically, {{site.project_title}} adds `foo` to the element's prototype with a value of `null`.
Specifically, {{site.project_title}} adds `foo` to the element's prototype with a value of `undefined`.

**Note:** Prior to {{site.project_title}} 0.3.5, properties were initialized to
`null` by default.
{: .alert .alert-info }

You can provide your own default values by explicitly specifying the default value on the elment's `prototype`:

Expand Down Expand Up @@ -669,7 +673,7 @@ For example, we can define a `name-tag` element that publishes two properties,
</script>
</polymer-element>

In this example, the published property `name` has initial value of `null` and `nameColor` has a value of "orange". Thus, the `<span>`'s color will be orange.
In this example, the published property `name` has initial value of `undefined` and `nameColor` has a value of "orange". Thus, the `<span>`'s color will be orange.

For more information see the [Data binding overview](databinding.html).

Expand Down

0 comments on commit c47421c

Please sign in to comment.