Update .attr to support collections

.attr was only setting the attributes on the first element in a
collection. It should have been setting the attributes on each element
in the collection (and now does). The 'getter' form of .attr will still
return the value in the first element.