I wanted to see what result I get when starting the next interface DOM 3

alert(DOMImplementation.hasFeature("Core", "3.0")); 

However, neither when using Microsoft Edge, nor when using Google Chrome received any reaction.

Is this DOM interface supported by 3 browsers, or am I doing something wrong?

  • one
  • It seems that this method is deprecated - Grundy
  • @Grundy When did he become deprecated? My true is not issued. - Vlad from Moscow
  • Yeah, I understand, it seems in this case the wrong use: DOMImplementation is an interface , so you can not access DOMImplementation.hasFeature . To get an instance of this interface, you need to use document.implementation - Grundy
  • @Grundy Write this in your reply. I just do not understand why the document is used, and not the window - Vlad from Moscow

1 answer 1

DOMImplementation is one of the interfaces provided by the browser, so to call the functions described in this interface, you need an object that implements this interface.

Such an object is defined in the Document interface.

 interface Document: Node {
   [SameObject] readonly attribute DOMImplementation implementation;
   ...
 }

Therefore, the call should look like this:

 alert(document.implementation.hasFeature("Core", "3.0")); 

But if you refer to the description of this method :

The hasFeature() method must return true.

It was not a good deal. ” As such, it should no longer be used.