title: creating new elements with html5 data attributes defined in DOM
body: <p>I want to create a new element with html5 data attributes defined, however they are not showing in the DOM (unlike when using say .addClass). is this intended behavior?</p>
  
  <p>this creates an element <em>without</em> the <code>data-foo</code> attributs:</p>
  
  <pre><code>-&gt; $("&lt;div&gt;foo&lt;/div&gt;").data('foo', 'bar').addClass('class')
  =&gt; &lt;div class="class"&gt;foo&lt;/div&gt;
  </code></pre>
  
  <p>i had to declare it in the constructor</p>
  
  <pre><code>-&gt; $("&lt;div data-foo='bar'&gt;foo&lt;/div&gt;").addClass('class')
  =&gt; &lt;div class="class" data-foo="bar"&gt;foo&lt;/div&gt;
  </code></pre>
  
  <p>shouldn't the .data method work do the same?</p>