Problem with attr() in Safari

Problem with attr() in Safari

Hi Guys

I have a div as follows:

<div id="div1" class="c1 test youtoo 3d"></div>

alert($("#div1").attr('class'));

When I get the contents of the attribute in firefox, it works fine but in safari it only returns the first selector (c1) only. Anyone know why this happens ?