Why does document.implementation.hasFeature () always return true?
I found a strange problem: any parameters passed to hasFeature always return true.
console.log(document.implementation.hasFeature('HTML', '2.0'));//return true
console.log(document.implementation.hasFeature('fake', '9.0'));//return true
Can someone tell me why the hasFeature () function is not working as expected?
+3
source to share
1 answer
From MDN: https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/hasFeature
The method DOMImplementation.hasFeature()
returns a Boolean flag indicating whether the given feature is supported. It is deprecated and modern browsers are correct in all cases.
The various implementations diverged quite a bit as to which features were introduced. The latest version of the spec decided to force this method to always return true where the functionality was precise and used.
+4
source to share