XML DOM normalize() Method

Definition and Usage

normalize() The method puts all text nodes under the node (including attribute nodes) into the paradigm, in which only structure (such as elements, comments, processing instructions, CDATA sections, and entity references) separates text nodes, that is, neither adjacent text nodes nor empty text nodes.

The paradigm is very useful for operations that require a specific document tree structure, and ensures that the XML DOM view of the document is the same when saved and reloaded.

Syntax

nodeObject.normalize()

Parameter

None.

Return Value

No return value.

Technical Details

DOM Version: Core Level 2 Node Object. Modified in DOM Level 3.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support

All mainstream browsers support normalize() Methods.