“innerHTML += …” vs “appendChild(txtNode)”

后端 未结 2 2067
暗喜
暗喜 2020-11-22 14:13

The question is, comparing concatination using innerHTML and appending a text node to an existing node. What is happening behind the scene?

My thoughts around this s

2条回答
  •  -上瘾入骨i
    2020-11-22 14:33

    I've created a small gist with a performance comparison between innerHTML and appendChild.

    The last one wins by a wide margin

    https://gist.github.com/oliverfernandez/5619180

提交回复
热议问题