📜  使用 `.createElement()` 和 `append()` 与 `.innerHTML` 的优缺点? - HTML代码示例

📅  最后修改于: 2022-03-11 14:53:28.790000             🧑  作者: Mango

代码示例1
Preserves existing references to DOM elements when appending elements. When you append to (or otherwise modify) innerHTML , all the DOM nodes inside that element have to be re-parsed and recreated. Preserves event handlers attached to any DOM elements. Could be simpler/faster in some cases.