XML DOM normalize() method

Definition and Usage

normalize() The method puts all text nodes under the node (including attribute nodes) into a schema, 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 schema 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.

Grammar

nodeObject.normalize()

参数

无。

返回值

无返回值。

技术细节

DOM 版本: Core Level 2 Node Object。在 DOM Level 3 中修改。

浏览器支持

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
支持 支持 支持 支持 支持

所有主流浏览器都支持 normalize() 方法。