Can anyone may explain me why creating object via string is slower than same object and execute addClass() method in jQuery?
I thought that addClass() method will be slower, but it is not. I'm wondering why?
Look at this jsPerf - http://jsperf.com/jquery-append-with-class-and-with-method-addclass
$("<div>", {"class":"foo"})
approach as well? Looking at the benchmarks it's still slower than.addClass()
. – Eyot