js performance issues
phpcn_u1582
phpcn_u1582 2017-05-19 10:24:14
0
4
447

There is a question that I have been holding back for a long time:
If you do not use event delegation, many people write like this (as shown above), looping the click event.
My question is:
Writing it this way is less code than writing it three times just for the page?
Or is the performance better? The good thing?

phpcn_u1582
phpcn_u1582

reply all(4)
大家讲道理

The code is less, more elegant, and there is not much difference in performance. But when writing like this, you have to be careful about the closure problem, that is, when the function uses i, you know.

phpcn_u1582

It’s just less code
The performance is the same

伊谢尔伦

The logic is simple and less error-prone, which increases overhead, but is generally not enough to affect performance. If the handler is taken out separately, the impact will be smaller.

仅有的幸福

The operation is the same, there is a loop, but the code is reduced.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template