googlearchive / TemplateBinding

TemplateBinding Prolyfill
290 stars 56 forks source link

Custom data elements are being flattened to a toString value. Expect the actual object to be stored. #115

Closed krisnye closed 11 years ago

krisnye commented 11 years ago
<!DOCTYPE html>
<html>
  <head>
    <script src="polymer.min.js" debug></script>
    <element name="v-bug">
        <template>
            <span data-sample="{{data}}" on-click="clicked">Click Me</span>
        </template>
        <script>
        Polymer.register(this, {
            data: { alpha: 1, beta: 2 },
            clicked: function(e, a, element) {
                alert("Expected: " + JSON.stringify(this.data) + "\n" + "Actual: " + JSON.stringify(element.dataset.sample));
            }
        });
        </script>
    </element>
  </head>
  <body>
    <v-bug></v-bug><br>
  </body>
</html>
krisnye commented 11 years ago

Actually, it looks like custom-data does not allow anything other than a String value to be stored. There should be some way however to store an object onto an element and get the actual object value back later.