create/append node vs innerHTML

后端 未结 7 2199
情歌与酒
情歌与酒 2021-01-05 18:40

Does anyone have a good reason to use one over the other? As far as I can tell, create/append node simply prevents you from creating invalid code, while innerHTML allows you

7条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-05 19:07

    I believe that on certain platforms, you'll receive a performance boost using the DOM functions instead of innerHTML, as no expensive HTML parsing needs to be done.

提交回复
热议问题