You are here: Reference > JavaScript > client-side > HTML DOM > objects > implementation

implementation object

Browser support:
Contains information about the features supported by the browser and provides methods for creating base objects.

Syntax:

Properties that reference the object:
object.implementation
Related objects:
The base interface, through which you can add new functionalities to the implementation object, is the DOMImplementation interface.

Possible members:

Methods:
createDocument
9
Creates an XML document object.
createDocumentType
9
Creates a new doctype object.
hasFeature
Returns whether the specified feature and version is implemented by the browser.

Example HTML code 1:

This example illustrates the use of the implementation object and the hasFeature method:
<head>
    <script type="text/javascript">
        function CheckFeature () {
            alert (document.implementation.hasFeature ("HTML","1.0"));
        }
    </script>
</head>
<body>
    <button onclick="CheckFeature ()">Is the DOM HTML 1.0 standard is implemented?</button>
</body>
Did you find this example helpful? yes no

Example HTML code 2:

This example illustrates the use of the implementation object and the createDocument and createDocumentType methods:
<head>
    <script type="text/javascript">
        function CreateXMLDoc () {
            if (document.implementation.createDocument && 
                document.implementation.createDocumentType) 
            {
                var fruitDocType = document.implementation.createDocumentType ("fruit", "SYSTEM", "<!ENTITY tf 'tropical fruit'>");
                var xmlDoc = document.implementation.createDocument ("", "fruits", fruitDocType);

                var fruitNode = xmlDoc.createElement ("fruit");
                fruitNode.setAttribute ("name" , "avocado");
                xmlDoc.documentElement.appendChild (fruitNode);
                
                var serializer = new XMLSerializer();
                alert (serializer.serializeToString (xmlDoc));
            }
            else {
                alert ("Your browser does not support this example");
            }
        }

    </script>
</head>
<body>
    <button onclick="CreateXMLDoc ();">Create an XML document with document type!</button>
</body>
Did you find this example helpful? yes no

External links:

User Contributed Comments

Post Content

Post Content