HTML | DOM implementation Property

The DOM implementation property in HTML is used to returns the DOMImplementation object associated with the current document. The DOMImplementation is the interface represents a method providing the object which is not dependent on any particular document.

Syntax:

document.implementation

Return Value: It returns the document implementation object.



Example 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!-- HTML code to check the document
has HTML DOM 1.0 feature -->
<!DOCTYPE html>
<html>
    <head>
        <title>
            HTML DOM implementation Property
        </title>
          
        <script>
            function DomFunction() {
                var obj = document.implementation;
                document.getElementById("demo").innerHTML 
                    = obj.hasFeature("HTML", "1.0");
            }
        </script>
    </head>
      
    <body>
        <h2>HTML DOM implementation Property</h2>
          
        <p>Click on button to check the document
        has HTML DOM 1.0 feature</p>
          
        <button onclick = "DomFunction()">
            Click Here!
        </button>
          
        <p id = "demo"></p>
    </body>
</html>                    

chevron_right


Output:
Before Click on the button:

After Click on the button:

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
    <head>
        <title>
            HTML DOM implementation Property
        </title>
    </head>
      
    <body>
        <h2>HTML DOM implementation Property</h2>
        <script>
            var DOM_Name = "HTML";
            var DOM_Ver = "1.0";
            var GFG = document.implementation.hasFeature( 
                        DOM_Name, DOM_Ver);
              
            alert( "DOM " + DOM_Name + " " + DOM_Ver 
                + " supported? " + GFG );
        </script>
    </body>
</html>                                

chevron_right


Output:
dom

Supported Browsers: The browser supported by DOM implementation property are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.