Q: Getting the list of polymer published properties Is there a way of getting the list of all published properties defined in a polymer component? (e.g. get the available properties of component public API)
<polymer-element name="sample-component"
                 attributes="foo1 foo2" bar="10">
   /* ... */
</polymer-element>

<sample-component foo1="5"></sample-component>


document.querySellector('sample-component').attributes;
// returns bar and foo1 (which have a value assigned to them)
// but I want to get foo1 and foo2


A: It's best to use element.publish to get the list of published properties for an element. (In polymer 1.0 element.properties does the same).
element.getAttribute('attributes) won't include the publish properties that are setup in a publish block.

A: You can access the element definition (i.e. the polymer-element itself) through the element property. So 
document.querySelector('sample-component')
  .element.getAttribute('attributes')

gives you 'foo1 foo2' (btw. inside an element you can simply write this.element.)
Be aware that this only works after Polymer has registered and processed all elements, so depending on where you want to use this statement, you may have to put it into a polymer-ready event handler:
<script>
  addEventListener('polymer-ready', function() {
    console.log(document.querySelector('sample-component')
      .element.getAttribute('attributes'));
  });
</script>

Update:
If you want to get a list of all published properties (i.e. the ones in the attributes attribute plus the ones of the publish: {} property), you can use
   Object.keys(document.querySelector('sample-component').publish)

which gives you ['foo1', 'foo2'].
