{"ScriptPreparationCode":"var parent = document.getElementById(\r\n \u0022parent\u0022\r\n);\r\nvar oldChildren = new Array();\r\n\r\nvar childNumber = 30;\r\nvar edgeGap = 3;\r\nvar startIdx = 0 \u002B edgeGap;\r\nvar endIdx = childNumber - 1 - edgeGap;\r\n\r\nfunction createDivWithText(text) {\r\n var div = document.createElement(\r\n \u0022div\u0022\r\n );\r\n var textNode = document.createTextNode(\r\n \u0022\u0022 \u002B text\r\n );\r\n div.appendChild(textNode);\r\n return div;\r\n};\r\n\r\nvar child;\r\nvar i = 0;\r\nwhile (i\u002B\u002B \u003C childNumber) {\r\n child = createDivWithText(i);\r\n parent.appendChild(child);\r\n oldChildren.push(child);\r\n};\r\n\r\nvar newChild = createDivWithText(\u0022new\u0022);\r\nvar idx;","TestCases":[{"Name":"replaceChild near start","Code":"idx = startIdx;\r\nparent.replaceChild(\r\n newChild,\r\n oldChildren[idx]\r\n);\r\nparent.replaceChild(\r\n oldChildren[idx],\r\n newChild\r\n);","IsDeferred":false},{"Name":"replaceChild near end","Code":"idx = endIdx;\r\nparent.replaceChild(\r\n newChild,\r\n oldChildren[idx]\r\n);\r\nparent.replaceChild(\r\n oldChildren[idx],\r\n newChild\r\n);","IsDeferred":false},{"Name":"removeChild \u002B insertBefore near start","Code":"idx = startIdx;\r\nparent.removeChild(\r\n oldChildren[idx]\r\n);\r\nparent.insertBefore(\r\n newChild,\r\n oldChildren[idx \u002B 1]\r\n);\r\nparent.removeChild(\r\n newChild\r\n);\r\nparent.insertBefore(\r\n oldChildren[idx],\r\n oldChildren[idx \u002B 1]\r\n);","IsDeferred":false},{"Name":"removeChild \u002B insertBefore near end","Code":"idx = endIdx;\r\nparent.removeChild(\r\n oldChildren[idx]\r\n);\r\nparent.insertBefore(\r\n newChild,\r\n oldChildren[idx \u002B 1]\r\n);\r\nparent.removeChild(\r\n newChild\r\n);\r\nparent.insertBefore(\r\n oldChildren[idx],\r\n oldChildren[idx \u002B 1]\r\n);","IsDeferred":false},{"Name":"insertBefore \u002B removeChild near start","Code":"idx = startIdx;\r\nparent.insertBefore(\r\n newChild,\r\n oldChildren[idx]\r\n);\r\nparent.removeChild(\r\n oldChildren[idx]\r\n);\r\nparent.insertBefore(\r\n oldChildren[idx],\r\n newChild\r\n);\r\nparent.removeChild(\r\n newChild\r\n);","IsDeferred":false},{"Name":"insertBefore \u002B removeChild near end","Code":"idx = endIdx;\r\nparent.insertBefore(\r\n newChild,\r\n oldChildren[idx]\r\n);\r\nparent.removeChild(\r\n oldChildren[idx]\r\n);\r\nparent.insertBefore(\r\n oldChildren[idx],\r\n newChild\r\n);\r\nparent.removeChild(\r\n newChild\r\n);","IsDeferred":false},{"Name":"insertBefore \u002B removeChild near start (variant 2)","Code":"idx = startIdx;\r\nparent.insertBefore(\r\n newChild,\r\n oldChildren[idx \u002B 1]\r\n);\r\nparent.removeChild(\r\n oldChildren[idx]\r\n);\r\nparent.insertBefore(\r\n oldChildren[idx],\r\n oldChildren[idx \u002B 1]\r\n);\r\nparent.removeChild(\r\n newChild\r\n);","IsDeferred":false},{"Name":"insertBefore \u002B removeChild near end (variant 2)","Code":"idx = endIdx;\r\nparent.insertBefore(\r\n newChild,\r\n oldChildren[idx \u002B 1]\r\n);\r\nparent.removeChild(\r\n oldChildren[idx]\r\n);\r\nparent.insertBefore(\r\n oldChildren[idx],\r\n oldChildren[idx \u002B 1]\r\n);\r\nparent.removeChild(\r\n newChild\r\n);","IsDeferred":false}]}