jquery: fastest DOM insertion?

后端 未结 8 1447
长情又很酷
长情又很酷 2020-12-04 16:45

I got this bad feeling about how I insert larger amounts of HTML. Lets assume we got:

var html=\"

....
\"
8条回答
  •  离开以前
    2020-12-04 17:29

    For starters, write a script that times how long it takes to do it 100 or 1,000 times with each method.

    To make sure the repeats aren't somehow optimized away--I'm no expert on JavaScript engines--vary the html you're inserting every time, say by putting '0001' then '0002' then '0003' in a certain cell of the table.

提交回复
热议问题