We would like to know how to remove DOM node without leaving whitespace.
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'>
window.onload=function(){<!--from w w w. j a v a 2 s . co m-->
var elem = document.getElementById('baz');
elem.parentNode.removeChild(elem);
}
</script>
</head>
<body>
... foo
<span id="baz">removed</span>bar ...
</body>
</html>
The code above is rendered as follows: