Test case details

Preparation Code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <div id='box'></div>
var box = document.getElementById('box');     for (var i=0;i<1000;i++){         var c   = document.createElement('div');         box.appendChild(c);     }

Test cases

Test #1

while (box.firstChild) {   box.removeChild(box.firstChild); }

Test #2

if (box.firstChild) box.innerHTML = '';

Test #3

$(box).detach();

Test #4

$(box).remove();