title: how to bind polymer custom element to the contents?
body: <p>I'm trying to create an element which has a dynamic number of tabs depending on what content is given to the element. The only way I've figured out how to do this is in JS but I have a feeling this isn't the Polymer way, what am I missing? Can you point me to some docs or other elements that will help me get started? </p>
  
  <p>here's what I have so far:</p>
  
  <p><strong>Using my custom element</strong></p>
  
  <pre><code>&lt;code-file-set&gt;
     &lt;a href="#" tabTitle="onelink"&gt;onelink&lt;/a&gt;
     &lt;a href="#" tabTitle="twolink"&gt;twolink&lt;/a&gt;
     &lt;a href="#" tabTitle="threelink"&gt;threelink&lt;/a&gt;
  &lt;/code-file-set&gt;
  </code></pre>
  
  <p><strong>Implementation of my custom element</strong></p>
  
  <pre><code>&lt;link rel="import" href="../bower_components/polymer/polymer.html"&gt;
  &lt;link rel="import" href="/bower_components/core-pages/core-pages.html"&gt;
  &lt;link rel="import" href="/bower_components/paper-tabs/paper-tabs.html"&gt;
  
  &lt;polymer-element name="code-file-set"&gt;
    &lt;template&gt;
  
        &lt;paper-tabs id="tabs" selected={{selected}}&gt;
        &lt;/paper-tabs&gt;
  
        &lt;core-pages selected="{{selected}}"&gt;
          &lt;content id="codecontent" select="a"&gt;&lt;/content&gt;
        &lt;/core-pages&gt;
    &lt;/template&gt;
  
  &lt;script&gt;
  
    Polymer('code-file-set', {
      domReady: function() {
        var codeNodes = this.$.codecontent.getDistributedNodes();
  
        for (var i = 0; i &lt; codeNodes.length; i++) {
          var name = codeNodes[i].getAttribute('tabTitle');
          var tab = document.createElement('paper-tab');
          tab.innerHTML = name;
          this.$.tabs.appendChild(tab);
        }    
        this.selected = 0;
      },
    });
  &lt;/script&gt;
  &lt;/polymer-element&gt;
  </code></pre>
  
  <p>This works, but it seems ugly. Namely, can creating the tabs not be done in JS but in a more declarative way in the HTML (notice that I create one tab per  element found in the content).</p>