I have the following dojo codes to create a surface graphics element under a div:
....
while (node.hasChildNodes()) { node.removeChild(node.lastChild); }