jquery getting element name - prop('name') or attr('name')
<p>I'm trying to get element name by jquery - </p>

<p>please check the following example code: (or <a href="http://jsbin.com/usujeq/2/watch" rel="nofollow">http://jsbin.com/usujeq/2/watch</a>)</p>

<pre><code>&lt;div name = "foo1"&gt;
  &lt;div name = "foo2"&gt;
    &lt;div name = "foo3"&gt;
      &lt;div name = "foo4"&gt;
        &lt;button id = "clickme" type="button"&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;script type="text/javascript"&gt;
$('#clickme').click( function() {
  $(this).parents().each( function() {
     console.log($(this).prop('name'));
  });
});
&lt;/script&gt;
</code></pre>

<p>if I click <code>clickme</code>, it should go up all over the DOM from <code>&lt;div name="foo4"&gt;</code> to <code>&lt;html&gt;</code> and log their names.</p>

<p>expected result is :</p>

<pre><code>foo4
foo3
foo2
foo1
undefined
undefined
</code></pre>

<p><code>prop('name')</code> returns undefined while <code>attr('name')</code> gives expected names.
what is wrong with <code>prop('name')</code> in above code?</p>
