The normalize() method of the Node interface puts the specified node and all of its sub-tree into a normalized form.
normalize()
MDN Reference