clean
clean<
T>(node):T
Defined in: core/dom/elements.ts:67
Removes the whitespace-only text nodes inside a node, at every depth.
This changes the node it is given and returns it. Use it to stop the gaps between inline elements, which come from the whitespace in the HTML source.
Type Parameters
Section titled “Type Parameters”T extends Node
Parameters
Section titled “Parameters”T
Node to clean, usually an element.
Returns
Section titled “Returns”T
The same node.
Example
Section titled “Example”clean($q('.menu')); // '<ul> <li>a</li> <li>b</li> </ul>' becomes '<ul><li>a</li><li>b</li></ul>'