|
|
|
|
|
by qbonnard
2849 days ago
|
|
> function addClass (el, cl) { if (el) { var a = el.className.split(' '); if (!afind(cl, a)) { a.unshift(cl); el.className = a.join(' ')}} } Why does it use `unshift` rather than `push` ? The only reason I can think of is that the last class added will be faster to remove when iterating over the array... |
|