Javascript DOM Document Create Fragment and Append
<html> <head> <title>Creating DocumentFragments and Appending them</title> </head>/* www .ja v a 2s . c o m*/ <body> <script type="text/javascript"> let aFragment = document.createDocumentFragment(); for (let i = 0; i < 20; i++) { let newParagraph = document.createElement("p"); let newText = "Hello World."; newParagraph.innerText = newText; newParagraph.textContent = newText; aFragment.appendChild(newParagraph); } document.body.appendChild(aFragment); </script> </body> </html>