title: dojo.dijit.Button fires onclick event twice
body: <p>I'm instantiating a dijit button inside a custom widget. That bit all works fine. In widget code I'm binding an onclick event handler but when I click the button the event fires twice. Also a second issue is that it also binds the click event to other buttons in the page that aren't related to the widget. Below is a simplified version I what I have. Can anyone tell me why it's doing that. I've spent the last couple of hours trying to fix it.</p>
  
  <p>The code is below but you can also see it here</p>
  
  <p>This is the html page which instantiates the custom widget
  <a href="https://github.com/screenm0nkey/dojo/blob/master/widgets/destroy-widget.html" rel="nofollow">https://github.com/screenm0nkey/dojo/blob/master/widgets/destroy-widget.html</a></p>
  
  <p>This is the custom widget
  <a href="https://github.com/screenm0nkey/dojo/blob/master/js/tag/widgets/DestroyWidget/Widget.js" rel="nofollow">https://github.com/screenm0nkey/dojo/blob/master/js/tag/widgets/DestroyWidget/Widget.js</a></p>
  
  <p>This is the template which contains the nested widget
  <a href="https://github.com/screenm0nkey/dojo/blob/master/js/tag/widgets/DestroyWidget/templates/template.html" rel="nofollow">https://github.com/screenm0nkey/dojo/blob/master/js/tag/widgets/DestroyWidget/templates/template.html</a></p>
  
  <p><strong>This is the html inside the widget template;</strong></p>
  
  <pre><code>&lt;div style="border: solid 1px pink"&gt;
  &lt;h3&gt;${name}&lt;/h3&gt;
  
  &lt;div dojoType="dijit.form.Button" data-dojo-attach-point="removeBtn" class="removeBtn"&gt;
    click me.
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>This is the JavaScript inside the widget which binds the handler;</strong></p>
  
  <pre><code>define('tag/Widget', ['dojo', 'dojo/parser', 'dijit/_Widget', 'dijit/_TemplatedMixin'],
  
  function(d, parser) {
  
  return d.declare('tag.Widget', [dijit._Widget, dijit._TemplatedMixin], {
  
  templateString : d.cache("tag", "/templates/template.html"),
  widgetsInTemplate : true,
  name : 'no name',
  button : 'no button',
  
  postCreate : function() {
    parser.parse(this.domNode);
    this.placeAt(d.byId('authorContainer'));
  },
  
  startup : function() {
    dijit.registry.forEach(dojo.hitch(this, function(w) {
      if (w.class === 'removeBtn') {
        this.button = w;
        return;
      }
    }))
  
    this.button.connect('onclick', function(evt) {
      console.log(evt.target);
    });
  },
  </code></pre>
  
  <p>});
  });</p>
  
  <p><strong>And this is the console output;</strong></p>
  
  <pre><code>&lt;input type="button" value="" class="dijitOffScreen" tabindex="-1" role="presentation" data-dojo-attach-point="valueNode"&gt;
  &lt;span class="dijitReset dijitInline dijitButtonText" id="dijit_form_Button_0_label" data-dojo-attach-point="containerNode"&gt;click me.&lt;/span&gt;
  </code></pre>