create/append node vs innerHTML

后端 未结 7 2217
情歌与酒
情歌与酒 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:03

    If performance matters, it's good to know that the innerHTML is relatively fast, especially in MSIE: http://www.quirksmode.org/dom/innerhtml.html

    It has however the bad image of originally being a "Microsoft proprietary" property and/or not really "OO".

提交回复
热议问题