How do you check if a JavaScript Object is a DOM Object?

后端 未结 30 2485
-上瘾入骨i
-上瘾入骨i 2020-11-22 16:06

I\'m trying to get:

document.createElement(\'div\')  //=> true
{tagName: \'foobar something\'}  //=> false

In my own scripts, I used

30条回答
  •  伪装坚强ぢ
    2020-11-22 16:25

    For the ones using Angular:

    angular.isElement
    

    https://docs.angularjs.org/api/ng/function/angular.isElement

提交回复
热议问题