{"ScriptPreparationCode":"var elements = [document.createElement(\u0027div\u0027), document.createElement(\u0027div\u0027)];\r\nvar fragment = document.createDocumentFragment();\r\nvar container = document.getElementById(\u0027test-element\u0027);\r\n\r\nelements.forEach(element =\u003E fragment.appendChild(element));\r\ncontainer.appendChild(fragment);","TestCases":[{"Name":"Cherrypick append child","Code":"var changeIndex = 1;\r\nelements[changeIndex] = document.createElement(\u0027div\u0027);\r\ncontainer.replaceChild(elements[changeIndex], container.children[changeIndex]);","IsDeferred":false},{"Name":"Using documentFragment, append new \u0026 reuse old children","Code":"var changeIndex = 1;\r\nvar newChildren = document.createDocumentFragment();\r\n\r\nelements[changeIndex] = document.createElement(\u0027div\u0027);\r\nelements.forEach(element =\u003E newChildren.appendChild(element));\r\n\r\nwhile(container.firstChild) {\r\n \tcontainer.firstChild.remove(); \r\n}\r\n\r\ncontainer.appendChild(newChildren)","IsDeferred":false},{"Name":"replaceChildren method","Code":"var changeIndex = 1;\r\n\r\nelements[changeIndex] = document.createElement(\u0027div\u0027);\r\ncontainer.replaceChildren(elements)","IsDeferred":false}]}