Fastest way to add/remove multiple elements in DOM

前端 未结 2 568
-上瘾入骨i
-上瘾入骨i 2021-01-13 00:21

Edit: It\'s not a duplicate of \"Fastest DOM insertion\" because it includes the event listeners variable too. Anyway I will edit the question.

I wo

2条回答
  •  灰色年华
    2021-01-13 01:02

    1   Set the value of innerHTML on the parent element to a string containing HTML for the new elements.
    2   Same as 1.
    4   Set the value of innerHTML on the parent element to an empty string.
    7.1   Call Node.removeChild(), save the returned Node object, and then pass the node to Node.appendChild().

提交回复
热议问题