jquery: fastest DOM insertion?

后端 未结 8 1456
长情又很酷
长情又很酷 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:27

    The answer about using a DOM fragment is on the right track. If you have a bunch of html objects that you are constant inserting into the DOM then you will see some speed improvements using the fragment. This post by John Resig explains it pretty well: http://ejohn.org/blog/dom-documentfragments/

提交回复
热议问题