Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why document.implementation.hasFeature() always return true?

Tags:

javascript

dom

I found a weird problem: whatever parameters passed to the hasFeature function, it always returns true.

console.log(document.implementation.hasFeature('HTML', '2.0'));//return true
console.log(document.implementation.hasFeature('fake', '9.0'));//return true

Can anyone pls tell me why the hasFeature() function does not work properly?

like image 404
marcel Avatar asked Apr 10 '17 07:04

marcel


1 Answers

From MDN: DOMImplementation.hasFeature()

The DOMImplementation.hasFeature() method returns a Boolean flag indicating if a given feature is supported. It is deprecated and modern browsers return true in all cases.

The different implementations fairly diverged in what kind of features were reported. The latest version of the spec settled to force this method to always return true, where the functionality was accurate and in use.

like image 130
Mamun Avatar answered Oct 19 '22 23:10

Mamun