jQuery select by class VS select by attribute

Viewed 11052

I want just to ask for an opinion of perfomance: Is it faster selecting elements by class name or by attribute name with jquery? Example I have 100 DIVs element in this form:

<div class="normal_box" normal_box=1>...</div>

Which is faster:

$('div.normal_box').each(function(){...});

VS

$('div[normal_box=1]').each(function(){...});

I made some experiments on 30 divs but I don't see any difference with (new Date).getTime(); Maybe selecting by class is more efficient on CPU usage?

2 Answers
Related