I'm trying to prevent the creation of empty text nodes whenever I add
- newlines,
- spaces (including non-breaking spaces)
- tabs
to my HTML structure.
Eg.
<div><div> <!-- Node not created -->
<div>
<!-- Node created -->
<div>
Eg1.
<div><div> <!-- Node not created -->
<div> <div> <!-- Node created -->
Eg2.
<div><div> <!-- Node not created -->
<div> <!-- Node created -->
<div>
<!-- Node created -->
</div>
<div> <!-- Node created -->
Here, for a better undestading:
see what happens into the first <DIV>
s -
jsFiddle
You can run a simple cleaning function on your DOM: