Home  >  Article  >  Web Front-end  >  JS public small method to determine whether the object is an instance of domElement

JS public small method to determine whether the object is an instance of domElement

高洛峰
高洛峰Original
2016-12-05 13:22:11857browse

The example is as follows:

function isDOMElement(obj) {
         return !!(obj && typeof window !== 'undefined' && (obj === window || obj.nodeType));
        }

The above example of JS public method to determine whether the object is domElement is all the content shared by the editor


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn