VOOZH about

URL: https://www.geeksforgeeks.org/html/html-dom-normalizedocument-method/

⇱ HTML DOM normalizeDocument() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

HTML DOM normalizeDocument() Method

Last Updated : 11 Jul, 2025
The normalizeDocument() method in HTML is used to normalize an HTML document by remove any empty text nodes if exists. After removing the empty nodes, it also merges all of the adjacent nodes present in the document. For Example, consider the below element:
Element Geeks
 Text node: ""
 Text node: "Hello "
 Text node: "wor"
 Text node: "ld"
The above element after normalization will become "Hello world". Note:This method is not supported by any browser, but it works as DOM normalize() Method and Display the output. Syntax:
geeknode.normalize()
Parameters:
  • The normalize() method does not require any parameter.
  • Example: Output : Before Normalize() call: 👁 Image
    After Normalize() call: 👁 Image
    Supported Browsers: The major browsers are not supported by DOM normalizeDocument() Method
    Comment