Name

Node.normalize( ) — merge adjacent Text nodes and remove empty ones

Availability

DOM Level 1 Core

Synopsis

void normalize(  );

Description

This method traverses all descendants of this node and “normalizes” the document by removing any empty Text nodes and merging all adjacent Text nodes into a single node. This can sometimes be useful to simplify the tree structure after node insertions or deletions.

See Also

Text

Get JavaScript: The Definitive Guide, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.