title: Iterating over element attributes with jQuery
body: <p>I know individual attributes can be retrieved with the <code>attr()</code> method, but I'm trying to iterate over <strong>all</strong> of the attributes for an element.  For context, I'm using jQuery on some XML...</p>
  
  <pre><code>&lt;items&gt;
    &lt;item id="id123" name="Fizz" value="Buzz" type="xyz"&gt;
      &lt;subitem name="foo"&gt;
      &lt;subitem name="bar"&gt;
    &lt;/item&gt;
    &lt;item id="id456" name="Bizz" value="Bazz" type="abc"&gt;
      &lt;subitem name="meh"&gt;
      &lt;subitem name="hem"&gt;
    &lt;/item&gt;
  &lt;/items&gt;
  </code></pre>
  
  <p>I am already able to iterate over the items with...</p>
  
  <pre><code>$(xml).find('item').each(function() {
    // Do something to each item here...
  });
  </code></pre>
  
  <p>But I'd like to be able to get an array of attributes for each 'item' so I can then iterate over those...</p>
  
  <p>e.g.</p>
  
  <pre><code>$(xml).find('item').each(function() {
    var attributes = $(this).attributes(); // returns an array of attributes?
    for (attribute in attributes) {
      // Do something with each attribute...
    }
  });
  </code></pre>
  
  <p>I've done some searching here, in the jQuery documentation, and elsewhere via Google but have had no luck.  If nothing else, I may just be having trouble excluding results relating to the <code>attr()</code> method of the jQuery object.  Thanks in advance.</p>